3v4l.org

run code in 300+ PHP versions simultaneously
<?php if (defined('HHVM_VERSION')) { exit('*HHVM skipped*'); } function myErrorHandler($errno, $errstr, $errfile, $errline) { if ($errno == E_NOTICE && in_array($errstr, array( 'Undefined variable: undefined', 'Undefined variable: undefined', ), true)) { echo "\n"; echo "Caught a Notice: Undefined variable: undefined in $errfile on line $errline\n"; return true; } if ($errno == E_WARNING && in_array($errstr, array( 'reset() expects parameter 1 to be array, null given', 'reset(): Passed variable is not an array or object', 'reset() [http://www.php.net/function.reset]: Passed variable is not an array or object', ), true)) { echo "\n"; echo "(caught the warning about null not being an array in $errfile on line $errline)\n"; return true; } return false; } set_error_handler('myErrorHandler'); // The following line will not emit a notice, because reset() takes its parameter by reference reset($undefined);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 2, Position 2 = 3
Branch analysis from position: 2
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 3
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/7jpXG
function name:  (null)
number of ops:  10
compiled vars:  !0 = $undefined
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   DEFINED                                                  'HHVM_VERSION'
          1      > JMPZ                                                     ~1, ->3
    4     2    > > EXIT                                                     '%2AHHVM+skipped%2A'
   31     3    >   INIT_FCALL                                               'set_error_handler'
          4        SEND_VAL                                                 'myErrorHandler'
          5        DO_ICALL                                                 
   34     6        INIT_FCALL                                               'reset'
          7        SEND_REF                                                 !0
          8        DO_ICALL                                                 
          9      > RETURN                                                   1

Function myerrorhandler:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 6, Position 2 = 8
Branch analysis from position: 6
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 17
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
2 jumps found. (Code = 46) Position 1 = 19, Position 2 = 21
Branch analysis from position: 19
2 jumps found. (Code = 43) Position 1 = 22, Position 2 = 30
Branch analysis from position: 22
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 30
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 21
Branch analysis from position: 8
filename:       /in/7jpXG
function name:  myErrorHandler
number of ops:  32
compiled vars:  !0 = $errno, !1 = $errstr, !2 = $errfile, !3 = $errline
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
          3        RECV                                             !3      
    9     4        IS_EQUAL                                         ~4      !0, 8
          5      > JMPZ_EX                                          ~4      ~4, ->8
          6    >   IN_ARRAY                                         ~5      !1, <array>
          7        BOOL                                             ~4      ~5
          8    > > JMPZ                                                     ~4, ->17
   13     9    >   ECHO                                                     '%0A'
   14    10        ROPE_INIT                                     5  ~7      'Caught+a+Notice%3A+Undefined+variable%3A+undefined+in+'
         11        ROPE_ADD                                      1  ~7      ~7, !2
         12        ROPE_ADD                                      2  ~7      ~7, '+on+line+'
         13        ROPE_ADD                                      3  ~7      ~7, !3
         14        ROPE_END                                      4  ~6      ~7, '%0A'
         15        ECHO                                                     ~6
   15    16      > RETURN                                                   <true>
   18    17    >   IS_EQUAL                                         ~10     !0, 2
         18      > JMPZ_EX                                          ~10     ~10, ->21
         19    >   IN_ARRAY                                         ~11     !1, <array>
         20        BOOL                                             ~10     ~11
         21    > > JMPZ                                                     ~10, ->30
   23    22    >   ECHO                                                     '%0A'
   24    23        ROPE_INIT                                     5  ~13     '%28caught+the+warning+about+null+not+being+an+array+in+'
         24        ROPE_ADD                                      1  ~13     ~13, !2
         25        ROPE_ADD                                      2  ~13     ~13, '+on+line+'
         26        ROPE_ADD                                      3  ~13     ~13, !3
         27        ROPE_END                                      4  ~12     ~13, '%29%0A'
         28        ECHO                                                     ~12
   25    29      > RETURN                                                   <true>
   28    30    > > RETURN                                                   <false>
   29    31*     > RETURN                                                   null

End of function myerrorhandler

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
157.55 ms | 1400 KiB | 17 Q