3v4l.org

run code in 300+ PHP versions simultaneously
<?php error_reporting( -1 ); #ini_set('display_errors', '1'); set_error_handler('my_error_handler'); $global_last_undefined_variable = false; function my_error_handler($severity, $message, $filename, $lineno) { global $global_last_undefined_variable; if ( $severity == E_NOTICE ) { if ( preg_match( '/^Undefined variable: (.*?)$/', $message, $matches ) ) { $global_last_undefined_variable = $matches[1]; } } return false; } function is_undefined( $var ) { global $global_last_undefined_variable; $result = $global_last_undefined_variable==$var; if ( $result ) $global_last_undefined_variable = false; return $result; } $last_notice = false; $a = null; // $b - undefined if ( $a===null && is_undefined( 'a' ) ) echo "a is undefined\n"; else echo "a is defined\n"; if ( $b===null && is_undefined( 'b' ) ) echo "b is undefined\n"; else echo "b is defined\n";
Output for git.master, git.master_jit, rfc.property-hooks
a is defined Warning: Undefined variable $b in /in/fY96G on line 44 b is defined

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
56.93 ms | 401 KiB | 8 Q