What does #numero_anything mean at the end of stdClass in an object var_dump in PHP?

3

Having this query to the database, configuring to obtain an object:

$data = [
    123 => 1000,
    5 =>  20000,
    9 =>  30000,
];
$id = 123;
$news = $pdo->query('SELECT * FROM personas')->fetchAll(PDO::FETCH_OBJ);
var_dump($news);

The var_dump returns this:

array(2) 
{ 
     [0]=> object(stdClass)#3 (3) 
     { 
        ["nombre"]=> string(4) "saul" 
        ["cedula"]=> int(23777344) 
        ["genero"]=> int(0) 
     } 

     [1]=> object(stdClass)#4 (3) 
     { 
        ["nombre"]=> string(6) "victor" 
        ["cedula"]=> int(25171681) 
        ["genero"]=> int(0) 
     } 
}

My question was: What does that # 3 and # 4 mean next to each object?:

object(stdClass)#3
object(stdClass)#4

Reading on php.net I found this:

 $obj3 = (object)[]; // Cast empty array to object
 object(stdClass)#3 (0) {}

It's like a conversion, but the #4

does not appear     
asked by Victor Alvarado 27.07.2017 в 03:43
source

1 answer

3

Taken from SO in English :

  

It is an internal reference to the instance of the object, it is the identifier of the object written in decimal.

Reference: link

php_printf("%sobject(%s)#%d (%d) {\n", COMMON, class_name, Z_OBJ_HANDLE_PP(struc), myht ? zend_hash_num_elements(myht) : 0);
    
answered by 27.07.2017 / 03:54
source