Jump to content


 


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.


Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

Photo

What is wrong with the PHP function


  • Please log in to reply
2 replies to this topic

#1 Cowtipper

Cowtipper

  • Members
  • 6 posts
  • OFFLINE
  •  
  • Local time:06:35 AM

Posted 04 September 2010 - 11:52 PM

I have dabbled a little bit in PHP before, but I am still quite the noob. So I ask you, what is wrong with this PHP function?


function noPlAdd($NoPlArCI)
{
	echo "<P />Notable players include: ";
	for ($i = 3; $i >=0; $i--)
	{
		if ($NoPlArCI[$i] == ' ')
		{
			unset($NoPlArCI[$i]);
		}
	}
	for ($i = 0; $i <= sizeof($NoPlArCI); $i++)
	{
		echo "".$NoPlArCI[$i]." ";
	}
	return;
}

It echoes the top line but doesn't seem to execute the for loops, even when it should. That is, it doesn't echo things when it should. Whatever am I doing wrong? I'll post the whole code if necessary.

Thanks for the help!

BC AdBot (Login to Remove)

 


#2 groovicus

groovicus

  • Security Colleague
  • 9,963 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Centerville, SD
  • Local time:04:35 AM

Posted 05 September 2010 - 10:29 AM

Maybe you should echo out the value of $NoPlArCI[$i] right before the first for loop and see what value it is pointing to.

#3 Cowtipper

Cowtipper
  • Topic Starter

  • Members
  • 6 posts
  • OFFLINE
  •  
  • Local time:06:35 AM

Posted 05 September 2010 - 01:12 PM

Uh, I don't even think my program is even adding stuff to the array to begin with. I guess I should fix that part first.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users