PHP Developers Network

A community of PHP developers offering assistance, advice, discussion, and friendship.
 
Loading
It is currently Sat Jun 23, 2018 9:09 am

All times are UTC - 5 hours




Post new topic Reply to topic  [ 1 post ] 
Author Message
PostPosted: Thu Jan 04, 2018 6:32 pm 
Offline
Forum Newbie

Joined: Thu Jan 04, 2018 6:11 pm
Posts: 1
The functions work however I need to iterate an array and if "even" print the array value if "odd" print "odd"; The for loop doesn't print the $i value and it doesn't print "odd" either?
thanks


function odd($var)
{
return($var & 1);
}

function even($var)
{
return(!($var & 1));
}
for ($i=0; $i<= sizeof($arr); $i++){
if ($arr_filter($arr,'even')==1){
print_r($arr=>$i);
}elseif($arr_filter($arr,'odd')==1)
{
print_r('odd');
}
}


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group