3v4l.org

run code in 300+ PHP versions simultaneously
<?php interface iCrud { public function create($data); public function read(); public function update($data); public function delete(); } class User implements iCrud { private $_userId = NULL; private $_username = NULL; function __construct($data) { $this->_userId = uniqid(); $this->_username = $data['username']; } function create($data) { self::__construct($data); } function read() { return array('userId' => $this->_userId, 'username' => $this->_username); } function update($data) { $this->_username = $data['username']; } public function delete() { $this->_username = NULL; $this->_userId = NULL; } } // assignment $u = new User(['username' => 'potato']); $u->create(['username' => 'notPotato']); var_dump($u);
Output for 7.4.1
object(User)#1 (2) { ["_userId":"User":private]=> string(13) "5c97610100110" ["_username":"User":private]=> string(9) "notPotato" }
Output for 7.4.0
object(User)#1 (2) { ["_userId":"User":private]=> string(13) "5c976101000d2" ["_username":"User":private]=> string(9) "notPotato" }
Output for 7.1.6, 7.2.7, 7.3.13
object(User)#1 (2) { ["_userId":"User":private]=> string(13) "5c9761010010a" ["_username":"User":private]=> string(9) "notPotato" }
Output for 7.3.12
object(User)#1 (2) { ["_userId":"User":private]=> string(13) "5c97610100134" ["_username":"User":private]=> string(9) "notPotato" }
Output for 7.3.11
object(User)#1 (2) { ["_userId":"User":private]=> string(13) "5c97610100129" ["_username":"User":private]=> string(9) "notPotato" }
Output for 7.3.10
object(User)#1 (2) { ["_userId":"User":private]=> string(13) "5c9761010015e" ["_username":"User":private]=> string(9) "notPotato" }
Output for 7.1.8, 7.3.9
object(User)#1 (2) { ["_userId":"User":private]=> string(13) "5c97610100130" ["_username":"User":private]=> string(9) "notPotato" }
Output for 7.2.21, 7.3.8
object(User)#1 (2) { ["_userId":"User":private]=> string(13) "5c976101000dd" ["_username":"User":private]=> string(9) "notPotato" }
Output for 7.3.7
object(User)#1 (2) { ["_userId":"User":private]=> string(13) "5c976101000cd" ["_username":"User":private]=> string(9) "notPotato" }
Output for 7.3.6
object(User)#1 (2) { ["_userId":"User":private]=> string(13) "5c97610100101" ["_username":"User":private]=> string(9) "notPotato" }
Output for 7.3.5
object(User)#1 (2) { ["_userId":"User":private]=> string(13) "5c976101000fa" ["_username":"User":private]=> string(9) "notPotato" }
Output for 7.3.4
object(User)#1 (2) { ["_userId":"User":private]=> string(13) "5c976101000d8" ["_username":"User":private]=> string(9) "notPotato" }
Output for 7.3.3
object(User)#1 (2) { ["_userId":"User":private]=> string(13) "5c976101000be" ["_username":"User":private]=> string(9) "notPotato" }
Output for 7.3.2
object(User)#1 (2) { ["_userId":"User":private]=> string(13) "5c976101000b1" ["_username":"User":private]=> string(9) "notPotato" }
Output for 7.3.1
object(User)#1 (2) { ["_userId":"User":private]=> string(13) "5c97610100092" ["_username":"User":private]=> string(9) "notPotato" }
Output for 7.3.0
object(User)#1 (2) { ["_userId":"User":private]=> string(13) "5c976101000f5" ["_username":"User":private]=> string(9) "notPotato" }
Output for 7.2.26
object(User)#1 (2) { ["_userId":"User":private]=> string(13) "5c97610100126" ["_username":"User":private]=> string(9) "notPotato" }
Output for 7.2.25
object(User)#1 (2) { ["_userId":"User":private]=> string(13) "5c9761010012f" ["_username":"User":private]=> string(9) "notPotato" }
Output for 7.2.24
object(User)#1 (2) { ["_userId":"User":private]=> string(13) "5c97610100153" ["_username":"User":private]=> string(9) "notPotato" }
Output for 7.2.23
object(User)#1 (2) { ["_userId":"User":private]=> string(13) "5c976101000c5" ["_username":"User":private]=> string(9) "notPotato" }
Output for 7.2.22
object(User)#1 (2) { ["_userId":"User":private]=> string(13) "5c97610100100" ["_username":"User":private]=> string(9) "notPotato" }
Output for 7.2.20
object(User)#1 (2) { ["_userId":"User":private]=> string(13) "5c976101000c7" ["_username":"User":private]=> string(9) "notPotato" }
Output for 7.2.19
object(User)#1 (2) { ["_userId":"User":private]=> string(13) "5c976101000cb" ["_username":"User":private]=> string(9) "notPotato" }
Output for 7.2.18
object(User)#1 (2) { ["_userId":"User":private]=> string(13) "5c976101000b6" ["_username":"User":private]=> string(9) "notPotato" }
Output for 7.2.17
object(User)#1 (2) { ["_userId":"User":private]=> string(13) "5c9761010011f" ["_username":"User":private]=> string(9) "notPotato" }
Output for 7.2.16
object(User)#1 (2) { ["_userId":"User":private]=> string(13) "5c976101000d7" ["_username":"User":private]=> string(9) "notPotato" }
Output for 7.2.15
object(User)#1 (2) { ["_userId":"User":private]=> string(13) "5c976101000a4" ["_username":"User":private]=> string(9) "notPotato" }
Output for 7.2.14
object(User)#1 (2) { ["_userId":"User":private]=> string(13) "5c976101000a7" ["_username":"User":private]=> string(9) "notPotato" }
Output for 7.2.11, 7.2.13
object(User)#1 (2) { ["_userId":"User":private]=> string(13) "5c976101000a3" ["_username":"User":private]=> string(9) "notPotato" }
Output for 7.2.12
object(User)#1 (2) { ["_userId":"User":private]=> string(13) "5c976101000ad" ["_username":"User":private]=> string(9) "notPotato" }
Output for 7.2.10
object(User)#1 (2) { ["_userId":"User":private]=> string(13) "5c976101000ef" ["_username":"User":private]=> string(9) "notPotato" }
Output for 7.2.9
object(User)#1 (2) { ["_userId":"User":private]=> string(13) "5c976101000bb" ["_username":"User":private]=> string(9) "notPotato" }
Output for 7.2.8
object(User)#1 (2) { ["_userId":"User":private]=> string(13) "5c976101000a8" ["_username":"User":private]=> string(9) "notPotato" }
Output for 7.2.6
object(User)#1 (2) { ["_userId":"User":private]=> string(13) "5c976101000d1" ["_username":"User":private]=> string(9) "notPotato" }
Output for 7.2.5
object(User)#1 (2) { ["_userId":"User":private]=> string(13) "5c976101000d3" ["_username":"User":private]=> string(9) "notPotato" }
Output for 7.2.4
object(User)#1 (2) { ["_userId":"User":private]=> string(13) "5c976101000ab" ["_username":"User":private]=> string(9) "notPotato" }
Output for 7.2.3
object(User)#1 (2) { ["_userId":"User":private]=> string(13) "5c976101000e0" ["_username":"User":private]=> string(9) "notPotato" }
Output for 7.2.2
object(User)#1 (2) { ["_userId":"User":private]=> string(13) "5c976101000e2" ["_username":"User":private]=> string(9) "notPotato" }
Output for 7.2.1
object(User)#1 (2) { ["_userId":"User":private]=> string(13) "5c97610100116" ["_username":"User":private]=> string(9) "notPotato" }
Output for 7.2.0
object(User)#1 (2) { ["_userId":"User":private]=> string(13) "5c9761010013d" ["_username":"User":private]=> string(9) "notPotato" }
Output for 7.1.33
object(User)#1 (2) { ["_userId":"User":private]=> string(13) "5c9761010011c" ["_username":"User":private]=> string(9) "notPotato" }
Output for 7.1.13, 7.1.32
object(User)#1 (2) { ["_userId":"User":private]=> string(13) "5c97610100149" ["_username":"User":private]=> string(9) "notPotato" }
Output for 7.1.31
object(User)#1 (2) { ["_userId":"User":private]=> string(13) "5c97610100165" ["_username":"User":private]=> string(9) "notPotato" }
Output for 7.1.30
object(User)#1 (2) { ["_userId":"User":private]=> string(13) "5c97610100106" ["_username":"User":private]=> string(9) "notPotato" }
Output for 7.1.29
object(User)#1 (2) { ["_userId":"User":private]=> string(13) "5c97610100109" ["_username":"User":private]=> string(9) "notPotato" }
Output for 7.1.28
object(User)#1 (2) { ["_userId":"User":private]=> string(13) "5c97610100188" ["_username":"User":private]=> string(9) "notPotato" }
Output for 7.1.27
object(User)#1 (2) { ["_userId":"User":private]=> string(13) "5c976101001ca" ["_username":"User":private]=> string(9) "notPotato" }
Output for 7.1.26
object(User)#1 (2) { ["_userId":"User":private]=> string(13) "5c9761010016c" ["_username":"User":private]=> string(9) "notPotato" }
Output for 7.1.25
object(User)#1 (2) { ["_userId":"User":private]=> string(13) "5c9761010015d" ["_username":"User":private]=> string(9) "notPotato" }
Output for 7.1.24
object(User)#1 (2) { ["_userId":"User":private]=> string(13) "5c97610100191" ["_username":"User":private]=> string(9) "notPotato" }
Output for 7.1.10, 7.1.23
object(User)#1 (2) { ["_userId":"User":private]=> string(13) "5c97610100139" ["_username":"User":private]=> string(9) "notPotato" }
Output for 7.1.22
object(User)#1 (2) { ["_userId":"User":private]=> string(13) "5c97610100121" ["_username":"User":private]=> string(9) "notPotato" }
Output for 7.1.21
object(User)#1 (2) { ["_userId":"User":private]=> string(13) "5c9761010015f" ["_username":"User":private]=> string(9) "notPotato" }
Output for 7.1.20
object(User)#1 (2) { ["_userId":"User":private]=> string(13) "5c9761010017e" ["_username":"User":private]=> string(9) "notPotato" }
Output for 7.1.19
object(User)#1 (2) { ["_userId":"User":private]=> string(13) "5c97610100113" ["_username":"User":private]=> string(9) "notPotato" }
Output for 7.1.18
object(User)#1 (2) { ["_userId":"User":private]=> string(13) "5c97610100172" ["_username":"User":private]=> string(9) "notPotato" }
Output for 7.1.17
object(User)#1 (2) { ["_userId":"User":private]=> string(13) "5c97610100124" ["_username":"User":private]=> string(9) "notPotato" }
Output for 7.1.16
object(User)#1 (2) { ["_userId":"User":private]=> string(13) "5c9761010012d" ["_username":"User":private]=> string(9) "notPotato" }
Output for 7.1.15
object(User)#1 (2) { ["_userId":"User":private]=> string(13) "5c9761010012a" ["_username":"User":private]=> string(9) "notPotato" }
Output for 7.1.14
object(User)#1 (2) { ["_userId":"User":private]=> string(13) "5c9761010017f" ["_username":"User":private]=> string(9) "notPotato" }
Output for 7.1.12
object(User)#1 (2) { ["_userId":"User":private]=> string(13) "5c9761010018e" ["_username":"User":private]=> string(9) "notPotato" }
Output for 7.1.11
object(User)#1 (2) { ["_userId":"User":private]=> string(13) "5c97610100146" ["_username":"User":private]=> string(9) "notPotato" }
Output for 7.1.9
object(User)#1 (2) { ["_userId":"User":private]=> string(13) "5c97610100118" ["_username":"User":private]=> string(9) "notPotato" }
Output for 7.1.7
object(User)#1 (2) { ["_userId":"User":private]=> string(13) "5c97610100159" ["_username":"User":private]=> string(9) "notPotato" }
Output for 7.1.5
object(User)#1 (2) { ["_userId":"User":private]=> string(13) "5c97610100111" ["_username":"User":private]=> string(9) "notPotato" }
Output for 7.1.4
object(User)#1 (2) { ["_userId":"User":private]=> string(13) "5c9761010010b" ["_username":"User":private]=> string(9) "notPotato" }
Output for 7.1.3
object(User)#1 (2) { ["_userId":"User":private]=> string(13) "5c976101001a9" ["_username":"User":private]=> string(9) "notPotato" }
Output for 7.1.2
object(User)#1 (2) { ["_userId":"User":private]=> string(13) "5c97610100132" ["_username":"User":private]=> string(9) "notPotato" }
Output for 7.1.1
object(User)#1 (2) { ["_userId":"User":private]=> string(13) "5c97610100183" ["_username":"User":private]=> string(9) "notPotato" }
Output for 7.1.0
object(User)#1 (2) { ["_userId":"User":private]=> string(13) "5c97610100105" ["_username":"User":private]=> string(9) "notPotato" }