Jump to content

Simple array question


atl_andy

Recommended Posts

Why does the output of the following simple array append a 1 at the end of any names or emails entered?  It doesn't matter how many items I put in the array, they all add a 1 at the end.  I have had it up to 10 names and emails.

 

 

$contact = array( array('email'=>$_GET['email1'],'name'=>$_GET['name1']), array('email'=>$_GET['email2'],'name'=>$_GET['name2']));

for ($i=0;$i<count($contact);$i++) {
   $next = $contact[$i];
   echo "<pre>";
   echo print_r($next['name']);
   echo "</pre>";

 

Output will be:

 

John1

Allen1

Link to comment
https://forums.phpfreaks.com/topic/99030-simple-array-question/
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.