otuatail Posted October 13, 2007 Share Posted October 13, 2007 Sorry about this simple array length what I need is for (x=1; size of the string array; x++) How to I get the size of the array Desmond Link to comment https://forums.phpfreaks.com/topic/73106-simple-array-length/ Share on other sites More sharing options...
cmgmyr Posted October 13, 2007 Share Posted October 13, 2007 $total = count($your_array); Link to comment https://forums.phpfreaks.com/topic/73106-simple-array-length/#findComment-368696 Share on other sites More sharing options...
marcus Posted October 13, 2007 Share Posted October 13, 2007 Based off Chris's code: for($i=1;$i<=count($your_array);$i++){ echo $i . "<br>\n"; } Link to comment https://forums.phpfreaks.com/topic/73106-simple-array-length/#findComment-368698 Share on other sites More sharing options...
cmgmyr Posted October 13, 2007 Share Posted October 13, 2007 yeah either way you need to do it. you can also do something like this: <?php foreach($your_array as $new_value){ echo "Do something with $new_value"; } ?> You can do that so you don't need to know how many are in the array Link to comment https://forums.phpfreaks.com/topic/73106-simple-array-length/#findComment-368701 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.