Jump to content

count number of rows in an object/array


Go to solution Solved by Ch0cu3r,

Recommended Posts

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

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 by Barand
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.