print_r a class : print_r : Development PHP Source Code


PHP Source Code » Development » print_r »

 

print_r a class



<?php
class Person {
    private $name;    
    private $age;    
    private $id;    

    function __construct$name, $age ) {
        $this->name = $name;
        $this->age = $age;
    }

    function setId$id ) {
        $this->id = $id;
    }
    
    function __clone() {
        $this->id = 0;
    }
}

$person = new Person"Joe"44 );
$person->setId111 );
$person2 = clone $person;
print$person );
print_r$person );
print$person2 );
print_r$person2 );

?>


           
       



HTML code for linking to this page:

    PHP Function Reference -> Users Code Examples / Notes - > print_r:
  • print_r
Follow Navioo On Twitter

PHP Source Code

 Navioo Development
» print_r