3v4l.org

run code in 300+ PHP versions simultaneously
<?php date_default_timezone_set('America/New_York'); $date = new DateTime(); 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/5FEbj
function name:  (null)
number of ops:  41
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        INIT_FCALL                                               'json_encode'
          7        SEND_VAR                                                 !0
          8        SEND_VAL                                                 16
          9        DO_ICALL                                         $5      
         10        ECHO                                                     $5
    8    11        INIT_FCALL                                               'var_dump'
         12        INIT_FCALL                                               'json_last_error'
         13        DO_ICALL                                         $6      
         14        SEND_VAR                                                 $6
         15        INIT_FCALL                                               'json_last_error_msg'
         16        DO_ICALL                                         $7      
         17        SEND_VAR                                                 $7
         18        DO_ICALL                                                 
   20    19        INIT_FCALL                                               'var_dump'
         20        INIT_FCALL                                               'isserializable'
         21        SEND_VAL                                                 <array>
         22        DO_FCALL                                      0  $9      
         23        SEND_VAR                                                 $9
         24        DO_ICALL                                                 
   21    25        INIT_FCALL                                               'var_dump'
         26        INIT_FCALL                                               'isserializable'
         27        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2F5FEbj%3A21%240'
         28        SEND_VAL                                                 ~11
         29        DO_FCALL                                      0  $12     
         30        SEND_VAR                                                 $12
         31        DO_ICALL                                                 
   22    32        INIT_FCALL                                               'var_dump'
         33        INIT_FCALL                                               'isserializable'
         34        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2F5FEbj%3A22%241'
         35        INIT_ARRAY                                       ~15     ~14
         36        SEND_VAL                                                 ~15
         37        DO_FCALL                                      0  $16     
         38        SEND_VAR                                                 $16
         39        DO_ICALL                                                 
         40      > 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/5FEbj
function name:  isSerializable
number of ops:  9
compiled vars:  !0 = $var, !1 = $e
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
   13     1        INIT_FCALL                                               'serialize'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                                 
   14     4      > RETURN                                                   <true>
          5*       JMP                                                      ->8
   15     6  E > > CATCH                                       last         'Exception'
   16     7    > > RETURN                                                   <false>
   18     8*     > RETURN                                                   null

End of function isserializable

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

End of function %00%7Bclosure%7D%2Fin%2F5FEbj%3A21%240

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

End of function %00%7Bclosure%7D%2Fin%2F5FEbj%3A22%241

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
156.15 ms | 1394 KiB | 28 Q