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 Quote 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); Quote 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"; } Quote 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 Quote Link to comment https://forums.phpfreaks.com/topic/73106-simple-array-length/#findComment-368701 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.