我'执行代码:PHP:的foreach警告
<?php
$input="ABC123";
$splits = chunk_split($input,2,"");
foreach($splits as $split)
{
$split = strrev($split);
$input = $input . $split;
}
?>
和输出,我希望是:
BA1C32
但gaves我警告。
Warning: Invalid argument supplied for foreach() in /home/WOOOOOOOOHOOOOOOOO/domains/badhamburgers.com/public_html/index.php on line 4
你可以先做'print_r($ splits)' –
chuck_split返回一个字符串,你不能对字符串做foreach – malletjo