以$ pitch为单位的foreach($ pitches as $ pitch)。$ i

时间:2017-11-20 19:23:22

标签: php foreach

如何在下面的代码中将$ i 添加到var $ pitch 。 结果应该是

  

$ pitch1,$ pitch2,$ pitch3等

$i = '1';
foreach($pitches as $pitch) {
    if($pitch->option_name == 'agent_pitch_'.$i) $pitch.$i = $pitch->option_value ;
    $i++;
}

0 个答案:

没有答案