3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Test { protected $test = ''; } $test = new Test(); echo 'before' . PHP_EOL; foreach ($test as $key => $value) { echo $key . ' ' . $value . PHP_EOL; } $test->testing = 'testing'; $test->_testing = 'testing2'; echo 'after' . PHP_EOL; foreach ($test as $key => $value) { echo $key . ' ' . $value . PHP_EOL; } var_dump($test); $test2 = unserialize(base64_decode(base64_encode(serialize($test)))); var_dump($test2); echo 'round2' . PHP_EOL; foreach ($test as $key => $value) { echo $key . ' ' . $value . PHP_EOL; }

preferences:
42.43 ms | 402 KiB | 5 Q