3v4l.org

run code in 300+ PHP versions simultaneously
<?php function var_import($var) { if (strcasecmp($var, 'null') === 0) { return null; } if (strcasecmp($var, 'true') === 0) { return true; } if (strcasecmp($var, 'false') === 0) { return false; } if ($var === ((string) (int) $var)) { return (int) $var; } if ($var === ((string) (float) $var)) { return (float) $var; } if (preg_match('<^"((?:[^"\\\\]|\\\\.)*)"|\'((?:[^\'\\\\]|\\\\.)*)\'$>', $var)) { return eval('return ' . $var . ';'); } throw new YUNOMAEKSENSEException('dumbass.'); } foreach ([ '1', '2.3', 'true', 'FALSE', 'Null', '"foo\nbar"', 'foobar', ] as $var) { ob_start(); var_dump(var_import($var)); echo sprintf('"%s" => %s', $var, trim(ob_get_clean())) . PHP_EOL; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 1, Position 2 = 23
Branch analysis from position: 1
2 jumps found. (Code = 78) Position 1 = 2, Position 2 = 23
Branch analysis from position: 2
1 jumps found. (Code = 42) Position 1 = 1
Branch analysis from position: 1
Branch analysis from position: 23
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 23
filename:       /in/3fbRG
function name:  (null)
number of ops:  25
compiled vars:  !0 = $var
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   27     0  E > > FE_RESET_R                                       $1      <array>, ->23
          1    > > FE_FETCH_R                                               $1, !0, ->23
   35     2    >   INIT_FCALL                                               'ob_start'
          3        DO_ICALL                                                 
   36     4        INIT_FCALL                                               'var_dump'
          5        INIT_FCALL                                               'var_import'
          6        SEND_VAR                                                 !0
          7        DO_FCALL                                      0  $3      
          8        SEND_VAR                                                 $3
          9        DO_ICALL                                                 
   37    10        INIT_FCALL                                               'sprintf'
         11        SEND_VAL                                                 '%22%25s%22+%3D%3E+%25s'
         12        SEND_VAR                                                 !0
         13        INIT_FCALL                                               'trim'
         14        INIT_FCALL                                               'ob_get_clean'
         15        DO_ICALL                                         $5      
         16        SEND_VAR                                                 $5
         17        DO_ICALL                                         $6      
         18        SEND_VAR                                                 $6
         19        DO_ICALL                                         $7      
         20        CONCAT                                           ~8      $7, '%0A'
         21        ECHO                                                     ~8
   27    22      > JMP                                                      ->1
         23    >   FE_FREE                                                  $1
   38    24      > RETURN                                                   1

Function var_import:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 8
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 15
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
2 jumps found. (Code = 43) Position 1 = 21, Position 2 = 22
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 22
2 jumps found. (Code = 43) Position 1 = 26, Position 2 = 28
Branch analysis from position: 26
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 28
2 jumps found. (Code = 43) Position 1 = 32, Position 2 = 34
Branch analysis from position: 32
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 34
2 jumps found. (Code = 43) Position 1 = 39, Position 2 = 43
Branch analysis from position: 39
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 43
1 jumps found. (Code = 108) Position 1 = -2
filename:       /in/3fbRG
function name:  var_import
number of ops:  48
compiled vars:  !0 = $var
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    5     1        INIT_FCALL                                               'strcasecmp'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 'null'
          4        DO_ICALL                                         $1      
          5        IS_IDENTICAL                                             $1, 0
          6      > JMPZ                                                     ~2, ->8
    6     7    > > RETURN                                                   null
    8     8    >   INIT_FCALL                                               'strcasecmp'
          9        SEND_VAR                                                 !0
         10        SEND_VAL                                                 'true'
         11        DO_ICALL                                         $3      
         12        IS_IDENTICAL                                             $3, 0
         13      > JMPZ                                                     ~4, ->15
    9    14    > > RETURN                                                   <true>
   11    15    >   INIT_FCALL                                               'strcasecmp'
         16        SEND_VAR                                                 !0
         17        SEND_VAL                                                 'false'
         18        DO_ICALL                                         $5      
         19        IS_IDENTICAL                                             $5, 0
         20      > JMPZ                                                     ~6, ->22
   12    21    > > RETURN                                                   <false>
   14    22    >   CAST                                          4  ~7      !0
         23        CAST                                          6  ~8      ~7
         24        IS_IDENTICAL                                             !0, ~8
         25      > JMPZ                                                     ~9, ->28
   15    26    >   CAST                                          4  ~10     !0
         27      > RETURN                                                   ~10
   17    28    >   CAST                                          5  ~11     !0
         29        CAST                                          6  ~12     ~11
         30        IS_IDENTICAL                                             !0, ~12
         31      > JMPZ                                                     ~13, ->34
   18    32    >   CAST                                          5  ~14     !0
         33      > RETURN                                                   ~14
   20    34    >   INIT_FCALL                                               'preg_match'
         35        SEND_VAL                                                 '%3C%5E%22%28%28%3F%3A%5B%5E%22%5C%5C%5D%7C%5C%5C.%29%2A%29%22%7C%27%28%28%3F%3A%5B%5E%27%5C%5C%5D%7C%5C%5C.%29%2A%29%27%24%3E'
         36        SEND_VAR                                                 !0
         37        DO_ICALL                                         $15     
         38      > JMPZ                                                     $15, ->43
   21    39    >   CONCAT                                           ~16     'return+', !0
         40        CONCAT                                           ~17     ~16, '%3B'
         41        INCLUDE_OR_EVAL                                  $18     ~17, EVAL
         42      > RETURN                                                   $18
   23    43    >   NEW                                              $19     'YUNOMAEKSENSEException'
         44        SEND_VAL_EX                                              'dumbass.'
         45        DO_FCALL                                      0          
         46      > THROW                                         0          $19
   24    47*     > RETURN                                                   null

End of function var_import

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.79 ms | 1407 KiB | 28 Q