Created
February 27, 2017 04:04
-
-
Save ilhamarrouf/fa5f22da673cf5b44fbf81c229292573 to your computer and use it in GitHub Desktop.
OOP PHP
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 | |
class test | |
{ | |
public $a; | |
private $b; | |
function __construct($a, $b) | |
{ | |
$this->a = $a; | |
$this->b = $b; | |
} | |
} | |
$a = new test("ankur" , "techflirt"); | |
$b = $a; //Copy of the object | |
$a->a = "no Ankur"; | |
print_r($a); | |
print_r($b); | |
?> | |
// Result of print_r | |
test Object | |
( | |
[a] => no Ankur | |
[b:test:private] => techflirt | |
) | |
test Object | |
( | |
[a] => no Ankur | |
[b:test:private] => techflirt | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment