开发者

Some small problem with strings, arrays and foreach

<?php


$ep_place = 'Arugghh!';    

$eps_array = array();

$eps_array[] = $ep_place;

foreach($eps_array[1] as $eps_match开发者_C百科)
{ 

$argh = $eps_match;

echo $argh;
}

?>

Warning: Invalid argument supplied for foreach()

What is it that I doing wrong here..?! I appreciate any help!


You are looping over the second element of $eps_array, which is wrong.

Change your foreach to:

foreach($eps_array as $eps_match) { }



$ep_place = 'Arugghh!';    

$eps_array = array();

$eps_array[] = $ep_place;

foreach($eps_array as $eps_match)
{ 

$argh = $eps_match;

echo $argh;
}

You should use array in foreach but not element of array

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜