Jump to content

[SOLVED] Function Help


thesoggycow

Recommended Posts

Hi Everyone,

 

I'm having trouble with a section of my script... Here it is

 

function getloc($data, $email) {
foreach ($data as $i => $value) {
	if ($value==$email) { return $i; break; }
	else { return "moo";}
}
}
$email = "[email protected]";
$data = array([email protected],0,5-13,69.232.189.155,[email protected],0,5-13,69.232.189.155);
$loc = getloc($data, $email); 

 

$loc should equal 4... But instead equals moo, no matter what.

 

What am I doing wrong?

Link to comment
https://forums.phpfreaks.com/topic/105557-solved-function-help/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.