每个项目的数组循环[关闭]

I have this array, I want to execute a command for each item in the array... I just don't know where to begin, here's what I got:

$xbb = array ('avotf1', 'avotf2', 'avotf3', 'avotf4');
for each $xbb [item] {
    echo "do something";
}

Any kind of help I can get on this is greatly appreciated!

Provided this is PHP?

Try

$xbb = array('avotf1','avotf2','avotf3','avotf4');

foreach($xbb as $item)
{
echo "$item:  do something";
}

If this is PHP, try:

$xbb = array ('avotf1', 'avotf2', 'avotf3', 'avotf4');
foreach ($xbb as $item)
{
   echo "Do something with $item";
}

i think this is PHP code,you can search the help with http://www.php.net/manual/en/control-structures.foreach.php

Try This

$xbb = array ('avotf1', 'avotf2', 'avotf3', 'avotf4');
foreach( (array) $xbb as $key => $value ) {
    echo "<br />".$key."=>".$value;
}