straygrey Posted October 5, 2013 Share Posted October 5, 2013 In PHP what would be the best method of counting how many rows are contained in the following:- object(stdClass)#5 (1) { ["GetMediaListResult"] => object(stdClass)#6 (1) { ["string"] => array(3) { [0] => string(5) "1.mp4" [1] => string(5) "2.mp4" [2] => string(5) "3.jpg" } } } obviously the answer is 3 but how to get this in a PHP program? Quote Link to comment https://forums.phpfreaks.com/topic/282732-count-number-of-rows-in-an-objectarray/ Share on other sites More sharing options...
Solution Ch0cu3r Posted October 5, 2013 Solution Share Posted October 5, 2013 Two second search on php.net for the word count results in count count($object->GetMediaListResult->string); Quote Link to comment https://forums.phpfreaks.com/topic/282732-count-number-of-rows-in-an-objectarray/#findComment-1452679 Share on other sites More sharing options...
Barand Posted October 5, 2013 Share Posted October 5, 2013 (edited) count returns the number of elements in an array. Reference the array in the same way as here http://forums.phpfreaks.com/topic/282534-extract-data/?do=findComment&comment=1451718 Edited October 5, 2013 by Barand Quote Link to comment https://forums.phpfreaks.com/topic/282732-count-number-of-rows-in-an-objectarray/#findComment-1452680 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.