3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $contact = new stdClass(); $magicField = '_' . __CLASS__ . '_' . __FUNCTION__; $contact->{$magicField}->custom->marketing_removed = true; $contact->{$magicField}->logic_hooks->after_save = true; if (isset($contact->{$magicField}) && isset($contact->{$magicField}->logic_hooks) && isset($contact->{$magicField}->logic_hooks->after_save) && $contact->{$magicField}->logic_hooks->after_save) { echo "-1-" . PHP_EOL; if (isset($contact->{$magicField}->custom) && isset($contact->{$magicField}->custom->marketing_removed)) { echo "-2-" . PHP_EOL; } }
based on hTCmi
Output for 5.6.30, hhvm-3.18.5 - 3.21.3, 7.0.30 - 7.3.0beta1
Warning: Creating default object from empty value in /in/R3m0L on line 5 Warning: Creating default object from empty value in /in/R3m0L on line 6 -1- -2-
Output for hhvm-3.22.0
Warning: Creating default object from empty value in /in/R3m0L on line -1 Warning: Creating default object from empty value in /in/R3m0L on line -1 -1- -2-