i’m new here and i’m learning php now and i don’t have a clue of mysql.
i want to do a little script that scans various arrays for the presence of a value and returns some values according to the fact that they’re there or not
i’ve done this:
<?php
$array1=array("a","b","c","d");
$array2=array("e","f","g","h");
$array3=array("g","f","e","d");
for($counter=1;$counter<4;$counter++)
{echo ''.in_array("d",$array$counter);}
?>
this isn’t working, i get “Parse error: syntax error, unexpected T_VARIABLE in … on line 7” but if i write:
<?php
$array1=array("a","b","c","d");
$array2=array("e","f","g","h");
$array3=array("g","f","e","d");
for($counter=1;$counter<4;$counter++)
{echo ''.in_array("d",$array1);}
?>
i get 111 as the output so the loop, echo and in_array are working fine and the area that’s giving the error is the “$array$counter”.
is there a way to fix this?
is there another way to increment an array inside loop functions?
is there another way of achieving what i want in a simple way?
thanks in advance and i hope someone can help me because i’ve searched for hours now and came up with nothing.
I think this is what you want: