3v4l.org

run code in 300+ PHP versions simultaneously
<?php set_error_handler(function (int $severity, string $message, string $filename, int $line) { echo "throwing\n"; throw new ErrorException($message, 0, $severity, $filename, $line); }); $stdObject = new stdClass(); //Can't be casted to string //array_diff compares array items CASTING them to string //http://php.net/manual/en/function.array-diff.php try { array_diff([], [$stdObject]); }catch(ErrorException $ee){ echo "Catched exception: " . $ee->getMessage() . "\n"; } echo "\n----------\n"; try { array_diff([$stdObject], []); }catch(ErrorException $ee){ echo "Catched exception: " . $ee->getMessage() . "\n"; }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 19
Branch analysis from position: 19
1 jumps found. (Code = 42) Position 1 = 32
Branch analysis from position: 32
1 jumps found. (Code = 62) Position 1 = -2
Found catch point at position: 13
Branch analysis from position: 13
2 jumps found. (Code = 107) Position 1 = 14, Position 2 = -2
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 32
Branch analysis from position: 32
Found catch point at position: 26
Branch analysis from position: 26
2 jumps found. (Code = 107) Position 1 = 27, Position 2 = -2
Branch analysis from position: 27
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/RYIo5
function name:  (null)
number of ops:  33
compiled vars:  !0 = $stdObject, !1 = $ee
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'set_error_handler'
          1        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FRYIo5%3A3%240'
    6     2        SEND_VAL                                                 ~2
          3        DO_ICALL                                                 
    8     4        NEW                                              $4      'stdClass'
          5        DO_FCALL                                      0          
          6        ASSIGN                                                   !0, $4
   14     7        INIT_FCALL                                               'array_diff'
          8        SEND_VAL                                                 <array>
          9        INIT_ARRAY                                       ~7      !0
         10        SEND_VAL                                                 ~7
         11        DO_ICALL                                                 
         12      > JMP                                                      ->19
   15    13  E > > CATCH                                       last         'ErrorException'
   16    14    >   INIT_METHOD_CALL                                         !1, 'getMessage'
         15        DO_FCALL                                      0  $9      
         16        CONCAT                                           ~10     'Catched+exception%3A+', $9
         17        CONCAT                                           ~11     ~10, '%0A'
         18        ECHO                                                     ~11
   19    19    >   ECHO                                                     '%0A----------%0A'
   22    20        INIT_FCALL                                               'array_diff'
         21        INIT_ARRAY                                       ~12     !0
         22        SEND_VAL                                                 ~12
         23        SEND_VAL                                                 <array>
         24        DO_ICALL                                                 
         25      > JMP                                                      ->32
   23    26  E > > CATCH                                       last         'ErrorException'
   24    27    >   INIT_METHOD_CALL                                         !1, 'getMessage'
         28        DO_FCALL                                      0  $14     
         29        CONCAT                                           ~15     'Catched+exception%3A+', $14
         30        CONCAT                                           ~16     ~15, '%0A'
         31        ECHO                                                     ~16
   25    32    > > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FRYIo5%3A3%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 108) Position 1 = -2
filename:       /in/RYIo5
function name:  {closure}
number of ops:  14
compiled vars:  !0 = $severity, !1 = $message, !2 = $filename, !3 = $line
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
          3        RECV                                             !3      
    4     4        ECHO                                                     'throwing%0A'
    5     5        NEW                                              $4      'ErrorException'
          6        SEND_VAR_EX                                              !1
          7        SEND_VAL_EX                                              0
          8        SEND_VAR_EX                                              !0
          9        SEND_VAR_EX                                              !2
         10        SEND_VAR_EX                                              !3
         11        DO_FCALL                                      0          
         12      > THROW                                         0          $4
    6    13*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FRYIo5%3A3%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.23 ms | 1400 KiB | 17 Q