Magento Expert Forum - Improve your Magento experience

Results 1 to 6 of 6

count() function in php

  1. #1

  2. #2
    New member
    Join Date
    Mar 2014
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

  3. #3
    New member
    Join Date
    May 2014
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Hello Friends

    count() Function is use to count.
    Example:

    <?
    $cars=array("Volvo","BMW","Toyota");
    echo count($cars);
    ?>

    Output is 3 Because there are 3 value in one array.

    I hope it's help you. If you want some more information please tell me i hope i will help you.

    Thank you

  4. #4
    Junior Member
    Join Date
    Sep 2018
    Location
    United Kingdom
    Posts
    156
    Thanks
    0
    Thanked 3 Times in 3 Posts

    Default

    The tally() work is utilized to check the components of an exhibit or the properties of an item. Note: For items, on the off chance that you have SPL introduced, you can guide into tally() by actualizing interface Countable. The interface has precisely one strategy, Countable::count(), which restores the arrival esteem for the check() work.

  5. #5
    Junior Member
    Join Date
    Sep 2018
    Location
    Canada
    Posts
    873
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default

    Answer: Use the PHP tally() or sizeof() work. You can utilize the PHP tally() or sizeof() capacity to get the quantity of components or qualities in a cluster. The check() and sizeof() work returns 0 for a variable that has been instated with a vacant exhibit, yet it might likewise return 0 for a variable that isn't set.

  6. #6
    Junior Member
    Join Date
    Sep 2018
    Location
    Canada
    Posts
    873
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default

    The count() function is used to count the elements of an array or the properties of an object. Note: For objects, if you have SPL installed, you can hook into count() by implementing interface Countable. The interface has exactly one method, Countable::count(), which returns the return value for the count() function.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •