3v4l.org

run code in 300+ PHP versions simultaneously
<?php //We enable error reporting, so we see everything //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]); }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 = 19
Branch analysis from position: 19
1 jumps found. (Code = 42) Position 1 = 33
Branch analysis from position: 33
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 = 33
Branch analysis from position: 33
Found catch point at position: 27
Branch analysis from position: 27
2 jumps found. (Code = 107) Position 1 = 28, Position 2 = -2
Branch analysis from position: 28
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/EjNPg
function name:  (null)
number of ops:  34
compiled vars:  !0 = $stdObject, !1 = $ee
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   INIT_FCALL                                               'set_error_handler'
          1        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FEjNPg%3A7%240'
   10     2        SEND_VAL                                                 ~2
          3        DO_ICALL                                                 
   12     4        NEW                                              $4      'stdClass'
          5        DO_FCALL                                      0          
          6        ASSIGN                                                   !0, $4
   18     7        INIT_FCALL                                               'array_diff'
          8        SEND_VAL                                                 <array>
          9        INIT_ARRAY                                       ~7      !0
         10        SEND_VAL                                                 ~7
         11        DO_ICALL                                                 
         12      > JMP                                                      ->19
   19    13  E > > CATCH                                       last         'ErrorException'
   20    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
   23    19    >   ECHO                                                     '%0A----------%0A'
   26    20        INIT_FCALL                                               'array_diff'
         21        INIT_ARRAY                                       ~12     !0
         22        SEND_VAL                                                 ~12
         23        INIT_ARRAY                                       ~13     !0
         24        SEND_VAL                                                 ~13
         25        DO_ICALL                                                 
         26      > JMP                                                      ->33
   27    27  E > > CATCH                                       last         'ErrorException'
   28    28    >   INIT_METHOD_CALL                                         !1, 'getMessage'
         29        DO_FCALL                                      0  $15     
         30        CONCAT                                           ~16     'Catched+exception%3A+', $15
         31        CONCAT                                           ~17     ~16, '%0A'
         32        ECHO                                                     ~17
   29    33    > > RETURN                                                   1

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

End of function %00%7Bclosure%7D%2Fin%2FEjNPg%3A7%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.03 ms | 1400 KiB | 17 Q