Mega Code Archive

 
Categories / Php / Class
 

Using the clone Statement

<?php      class Integer {           private $number;           public function getInt() {                return (int)$this->number;           }           public function setInt($num) {                $this->number = (int)$num;           }      }            $class_one = new Integer();      $class_one_copy = clone $class_one; ?>