gamesmstr Posted September 9, 2009 Share Posted September 9, 2009 I can't for the life of me see what is wrong here.. Not doing anything hard, just adding values to the end of an array. Code: <?php $test=array("1","2","3"); echo sizeof($test) . "<br>"; $test=array_push($test,"4","5"); echo sizeof($test) . "<br>"; ?> This gives me: 3 1 Anyone have any idea why that isn't: 3 5 ? Link to comment https://forums.phpfreaks.com/topic/173714-solved-array_push-not-working/ Share on other sites More sharing options...
Maq Posted September 9, 2009 Share Posted September 9, 2009 Don't redefine $test by assigning it to the array_push. Link to comment https://forums.phpfreaks.com/topic/173714-solved-array_push-not-working/#findComment-915684 Share on other sites More sharing options...
gamesmstr Posted September 9, 2009 Author Share Posted September 9, 2009 DOH! Thanks. I knew it had to be something stupid... Link to comment https://forums.phpfreaks.com/topic/173714-solved-array_push-not-working/#findComment-915687 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.