3v4l.org

run code in 300+ PHP versions simultaneously
<?php error_reporting(E_ALL); ini_set('display_errors', 1); 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], [$stdObject]); }catch(ErrorException $ee){ echo "Catched exception: " . $ee->getMessage() . "\n"; } echo "\n----------\n"; try { array_diff([$stdObject], [$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 = 27
Branch analysis from position: 27
1 jumps found. (Code = 42) Position 1 = 41
Branch analysis from position: 41
1 jumps found. (Code = 62) Position 1 = -2
Found catch point at position: 21
Branch analysis from position: 21
2 jumps found. (Code = 107) Position 1 = 22, Position 2 = -2
Branch analysis from position: 22
1 jumps found. (Code = 42) Position 1 = 41
Branch analysis from position: 41
Found catch point at position: 35
Branch analysis from position: 35
2 jumps found. (Code = 107) Position 1 = 36, Position 2 = -2
Branch analysis from position: 36
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fKc22
function name:  (null)
number of ops:  42
compiled vars:  !0 = $stdObject, !1 = $ee
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'error_reporting'
          1        SEND_VAL                                                 32767
          2        DO_ICALL                                                 
    4     3        INIT_FCALL                                               'ini_set'
          4        SEND_VAL                                                 'display_errors'
          5        SEND_VAL                                                 1
          6        DO_ICALL                                                 
    6     7        INIT_FCALL                                               'set_error_handler'
          8        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FfKc22%3A6%240'
    9     9        SEND_VAL                                                 ~4
         10        DO_ICALL                                                 
   11    11        NEW                                              $6      'stdClass'
         12        DO_FCALL                                      0          
         13        ASSIGN                                                   !0, $6
   17    14        INIT_FCALL                                               'array_diff'
         15        INIT_ARRAY                                       ~9      !0
         16        SEND_VAL                                                 ~9
         17        INIT_ARRAY                                       ~10     !0
         18        SEND_VAL                                                 ~10
         19        DO_ICALL                                                 
         20      > JMP                                                      ->27
   18    21  E > > CATCH                                       last         'ErrorException'
   19    22    >   INIT_METHOD_CALL                                         !1, 'getMessage'
         23        DO_FCALL                                      0  $12     
         24        CONCAT                                           ~13     'Catched+exception%3A+', $12
         25        CONCAT                                           ~14     ~13, '%0A'
         26        ECHO                                                     ~14
   22    27    >   ECHO                                                     '%0A----------%0A'
   25    28        INIT_FCALL                                               'array_diff'
         29        INIT_ARRAY                                       ~15     !0
         30        SEND_VAL                                                 ~15
         31        INIT_ARRAY                                       ~16     !0
         32        SEND_VAL                                                 ~16
         33        DO_ICALL                                                 
         34      > JMP                                                      ->41
   26    35  E > > CATCH                                       last         'ErrorException'
   27    36    >   INIT_METHOD_CALL                                         !1, 'getMessage'
         37        DO_FCALL                                      0  $18     
         38        CONCAT                                           ~19     'Catched+exception%3A+', $18
         39        CONCAT                                           ~20     ~19, '%0A'
         40        ECHO                                                     ~20
   28    41    > > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FfKc22%3A6%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 108) Position 1 = -2
filename:       /in/fKc22
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
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
          3        RECV                                             !3      
    7     4        ECHO                                                     'throwing%0A'
    8     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
    9    13*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FfKc22%3A6%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
177.22 ms | 1400 KiB | 21 Q