3v4l.org

run code in 300+ PHP versions simultaneously
<?php set_error_handler(function (int $serverity, string $message, string $filename, int $line) { echo "throwing\n"; throw new ErrorException($message, 0, $serverity, $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"; }
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 = 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 = 62) Position 1 = -2
filename:       /in/bTW4M
function name:  (null)
number of ops:  20
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%2FbTW4M%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
   17    19    > > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FbTW4M%3A3%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 108) Position 1 = -2
filename:       /in/bTW4M
function name:  {closure}
number of ops:  14
compiled vars:  !0 = $serverity, !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%2FbTW4M%3A3%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
168.49 ms | 1396 KiB | 17 Q