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? Link to comment https://forums.phpfreaks.com/topic/282732-count-number-of-rows-in-an-objectarray/ Share on other sites More sharing options...
Ch0cu3r Posted October 5, 2013 Share Posted October 5, 2013 Two second search on php.net for the word count results in count count($object->GetMediaListResult->string); 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 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 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
Archived
This topic is now archived and is closed to further replies.