Created
October 29, 2015 20:01
-
-
Save coderdiaz/f344ccfe4a137f42d451 to your computer and use it in GitHub Desktop.
Obtener el tamaño de un objeto
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$objeto = new StdClass; | |
$objeto->key1 = 0; | |
$objeto->key2 = 0; | |
$objeto->key3 = 0; | |
$objeto->key4 = 0; | |
echo count((array) $objeto); | |
/* Casteamos el objeto a arreglo y ya se puede obtener el tamaño del objeto */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment