3v4l.org

run code in 300+ PHP versions simultaneously
<?php date_default_timezone_set('America/New_York'); $date = new DateTime(); $date::jsonSerialize(); echo json_encode($date,JSON_FORCE_OBJECT); var_dump(json_last_error(), json_last_error_msg()); function isSerializable( $var ) { try { serialize( $var ); return TRUE; } catch( Exception $e ) { return FALSE; } } var_dump( isSerializable( array() ) ); // bool(true) var_dump( isSerializable( function() {} ) ); // bool(false) var_dump( isSerializable( array( function() {} ) ) );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/DCvSp
function name:  (null)
number of ops:  44
compiled vars:  !0 = $date
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'date_default_timezone_set'
          1        SEND_VAL                                                 'America%2FNew_York'
          2        DO_ICALL                                                 
    5     3        NEW                                              $2      'DateTime'
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !0, $2
    7     6        FETCH_CLASS                                   0  $5      !0
          7        INIT_STATIC_METHOD_CALL                                  $5, 'jsonSerialize'
          8        DO_FCALL                                      0          
    9     9        INIT_FCALL                                               'json_encode'
         10        SEND_VAR                                                 !0
         11        SEND_VAL                                                 16
         12        DO_ICALL                                         $7      
         13        ECHO                                                     $7
   10    14        INIT_FCALL                                               'var_dump'
         15        INIT_FCALL                                               'json_last_error'
         16        DO_ICALL                                         $8      
         17        SEND_VAR                                                 $8
         18        INIT_FCALL                                               'json_last_error_msg'
         19        DO_ICALL                                         $9      
         20        SEND_VAR                                                 $9
         21        DO_ICALL                                                 
   22    22        INIT_FCALL                                               'var_dump'
         23        INIT_FCALL                                               'isserializable'
         24        SEND_VAL                                                 <array>
         25        DO_FCALL                                      0  $11     
         26        SEND_VAR                                                 $11
         27        DO_ICALL                                                 
   23    28        INIT_FCALL                                               'var_dump'
         29        INIT_FCALL                                               'isserializable'
         30        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FDCvSp%3A23%240'
         31        SEND_VAL                                                 ~13
         32        DO_FCALL                                      0  $14     
         33        SEND_VAR                                                 $14
         34        DO_ICALL                                                 
   24    35        INIT_FCALL                                               'var_dump'
         36        INIT_FCALL                                               'isserializable'
         37        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FDCvSp%3A24%241'
         38        INIT_ARRAY                                       ~17     ~16
         39        SEND_VAL                                                 ~17
         40        DO_FCALL                                      0  $18     
         41        SEND_VAR                                                 $18
         42        DO_ICALL                                                 
         43      > RETURN                                                   1

Function isserializable:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
Found catch point at position: 6
Branch analysis from position: 6
2 jumps found. (Code = 107) Position 1 = 7, Position 2 = -2
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/DCvSp
function name:  isSerializable
number of ops:  9
compiled vars:  !0 = $var, !1 = $e
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   RECV                                             !0      
   15     1        INIT_FCALL                                               'serialize'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                                 
   16     4      > RETURN                                                   <true>
          5*       JMP                                                      ->8
   17     6  E > > CATCH                                       last         'Exception'
   18     7    > > RETURN                                                   <false>
   20     8*     > RETURN                                                   null

End of function isserializable

Function %00%7Bclosure%7D%2Fin%2FDCvSp%3A23%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/DCvSp
function name:  {closure}
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E > > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FDCvSp%3A23%240

Function %00%7Bclosure%7D%2Fin%2FDCvSp%3A24%241:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/DCvSp
function name:  {closure}
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   24     0  E > > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FDCvSp%3A24%241

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150.52 ms | 1403 KiB | 28 Q