我'執行代碼: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