Skip to content

PHP Blog

Snippets and guides

Andre Board

LAMP PHP Developer, Zend Certified PHP Engineer (ZCE), Certified Laravel Developer

  • GitHub
  • Portfolio

Recent Posts

  • PHP Self Type Hint
  • Closure vs Callable Type Hinting
  • PHP Overloading vs Overriding
  • Law of Demeter in PHP
  • PHP Higher Order Functions

Recent Comments

    Categories

    • advanced
    • apache
    • design patterns
    • http
    • mysql
    • php
    • Uncategorized

    Meta

    • Log in
    • Entries feed
    • Comments feed
    • WordPress.org

    Counting a PHP stdClass Object

    $obj = new stdClass;
    $obj->one = 1;
    $obj->two = 2;
    $vars = get_object_vars($obj);
    echo count($vars);
    Posted on April 3, 2019April 14, 2019Author dreboardCategories phpTags objects

    Post navigation

    Previous Previous post: PHP Errors and Logging Settings
    Next Next post: PHP: get_called_class vs get_class
    Proudly powered by WordPress