Tuesday, 15 July 2014

foreach - Getting the even entries using PHP -



foreach - Getting the even entries using PHP -

im trying create foreach loop prints out lines in variable have tried doing code this:

$admin = '1'; if ($admin = 0) { echo "even"; $admin = '1'; continue; } if ($admin = 1) { echo "odd"; $admin = '0'; }

but odd , never even.. im doing wrong..

if of have thought love know think

if work if $admin = 0 print line of course of study , not "even"

you using wrong operator checking. = used declaration while == must used valuating.

try,

if($admin==0) { echo "even"; }

while,

$admin=0 // sets value 0 variable $admin

php foreach

No comments:

Post a Comment