3v4l.org

run code in 300+ PHP versions simultaneously
<?php function GET($name = NULL, $value = false) { $content = (!empty($_GET[$name]) ? trim($_GET[$name]) : (!empty($value) && !is_array($value) ? trim($value) : false)); if (is_numeric($content)) return preg_replace("@([^0-9])@Ui", "", $content); else if (is_bool($content)) return ($content ? true : false); else if (is_float($content)) return preg_replace('@([^0-9\,\.\+\-])@Ui', "", $content); else if (is_string($content)) { if (filter_var($content, FILTER_VALIDATE_URL)) return $content; else if (filter_var($content, FILTER_VALIDATE_EMAIL)) return $content; else if (filter_var($content, FILTER_VALIDATE_IP)) return $content; else if (filter_var($content, FILTER_VALIDATE_FLOAT)) return $content; else return preg_replace('@(\p{C})@ui', "", $content); } else false; } $_GET['foo'] = 'Detta är en annons'; $_GET['bar'] = '2^8'; var_dump(GET('foo')); var_dump(GET('bar'));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/YmDiL
function name:  (null)
number of ops:  19
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   26     0  E >   FETCH_W                      global              $0      '_GET'
          1        ASSIGN_DIM                                               $0, 'foo'
          2        OP_DATA                                                  'Detta+%C3%A4r+en+annons'
   27     3        FETCH_W                      global              $2      '_GET'
          4        ASSIGN_DIM                                               $2, 'bar'
          5        OP_DATA                                                  '2%5E8'
   28     6        INIT_FCALL                                               'var_dump'
          7        INIT_FCALL                                               'get'
          8        SEND_VAL                                                 'foo'
          9        DO_FCALL                                      0  $4      
         10        SEND_VAR                                                 $4
         11        DO_ICALL                                                 
   29    12        INIT_FCALL                                               'var_dump'
         13        INIT_FCALL                                               'get'
         14        SEND_VAL                                                 'bar'
         15        DO_FCALL                                      0  $6      
         16        SEND_VAR                                                 $6
         17        DO_ICALL                                                 
         18      > RETURN                                                   1

Function get:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 13
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 27
Branch analysis from position: 27
2 jumps found. (Code = 43) Position 1 = 32, Position 2 = 39
Branch analysis from position: 32
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 39
2 jumps found. (Code = 43) Position 1 = 41, Position 2 = 47
Branch analysis from position: 41
2 jumps found. (Code = 43) Position 1 = 42, Position 2 = 44
Branch analysis from position: 42
1 jumps found. (Code = 42) Position 1 = 45
Branch analysis from position: 45
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 44
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 47
2 jumps found. (Code = 43) Position 1 = 49, Position 2 = 56
Branch analysis from position: 49
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 56
2 jumps found. (Code = 43) Position 1 = 58, Position 2 = 93
Branch analysis from position: 58
2 jumps found. (Code = 43) Position 1 = 63, Position 2 = 65
Branch analysis from position: 63
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 65
2 jumps found. (Code = 43) Position 1 = 70, Position 2 = 72
Branch analysis from position: 70
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 72
2 jumps found. (Code = 43) Position 1 = 77, Position 2 = 79
Branch analysis from position: 77
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 79
2 jumps found. (Code = 43) Position 1 = 84, Position 2 = 86
Branch analysis from position: 84
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 86
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 93
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
2 jumps found. (Code = 46) Position 1 = 16, Position 2 = 19
Branch analysis from position: 16
2 jumps found. (Code = 43) Position 1 = 20, Position 2 = 25
Branch analysis from position: 20
1 jumps found. (Code = 42) Position 1 = 26
Branch analysis from position: 26
2 jumps found. (Code = 43) Position 1 = 32, Position 2 = 39
Branch analysis from position: 32
Branch analysis from position: 39
Branch analysis from position: 25
2 jumps found. (Code = 43) Position 1 = 32, Position 2 = 39
Branch analysis from position: 32
Branch analysis from position: 39
Branch analysis from position: 19
filename:       /in/YmDiL
function name:  GET
number of ops:  94
compiled vars:  !0 = $name, !1 = $value, !2 = $content
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV_INIT                                        !0      null
          1        RECV_INIT                                        !1      <false>
    5     2        FETCH_IS                                         ~3      '_GET'
          3        ISSET_ISEMPTY_DIM_OBJ                         1  ~4      ~3, !0
          4        BOOL_NOT                                         ~5      ~4
          5      > JMPZ                                                     ~5, ->13
          6    >   INIT_FCALL                                               'trim'
          7        FETCH_R                      global              ~6      '_GET'
          8        FETCH_DIM_R                                      ~7      ~6, !0
          9        SEND_VAL                                                 ~7
         10        DO_ICALL                                         $8      
         11        QM_ASSIGN                                        ~9      $8
         12      > JMP                                                      ->27
         13    >   ISSET_ISEMPTY_CV                                 ~10     !1
         14        BOOL_NOT                                         ~11     ~10
         15      > JMPZ_EX                                          ~11     ~11, ->19
         16    >   TYPE_CHECK                                  128  ~12     !1
         17        BOOL_NOT                                         ~13     ~12
         18        BOOL                                             ~11     ~13
         19    > > JMPZ                                                     ~11, ->25
         20    >   INIT_FCALL                                               'trim'
         21        SEND_VAR                                                 !1
         22        DO_ICALL                                         $14     
         23        QM_ASSIGN                                        ~15     $14
         24      > JMP                                                      ->26
         25    >   QM_ASSIGN                                        ~15     <false>
         26    >   QM_ASSIGN                                        ~9      ~15
         27    >   ASSIGN                                                   !2, ~9
    6    28        INIT_FCALL                                               'is_numeric'
         29        SEND_VAR                                                 !2
         30        DO_ICALL                                         $17     
         31      > JMPZ                                                     $17, ->39
    7    32    >   INIT_FCALL                                               'preg_replace'
         33        SEND_VAL                                                 '%40%28%5B%5E0-9%5D%29%40Ui'
         34        SEND_VAL                                                 ''
         35        SEND_VAR                                                 !2
         36        DO_ICALL                                         $18     
         37      > RETURN                                                   $18
    6    38*       JMP                                                      ->93
    8    39    >   TYPE_CHECK                                   12          !2
         40      > JMPZ                                                     ~19, ->47
    9    41    > > JMPZ                                                     !2, ->44
         42    >   QM_ASSIGN                                        ~20     <true>
         43      > JMP                                                      ->45
         44    >   QM_ASSIGN                                        ~20     <false>
         45    > > RETURN                                                   ~20
    8    46*       JMP                                                      ->93
   10    47    >   TYPE_CHECK                                   32          !2
         48      > JMPZ                                                     ~21, ->56
   11    49    >   INIT_FCALL                                               'preg_replace'
         50        SEND_VAL                                                 '%40%28%5B%5E0-9%5C%2C%5C.%5C%2B%5C-%5D%29%40Ui'
         51        SEND_VAL                                                 ''
         52        SEND_VAR                                                 !2
         53        DO_ICALL                                         $22     
         54      > RETURN                                                   $22
   10    55*       JMP                                                      ->93
   12    56    >   TYPE_CHECK                                   64          !2
         57      > JMPZ                                                     ~23, ->93
   13    58    >   INIT_FCALL                                               'filter_var'
         59        SEND_VAR                                                 !2
         60        SEND_VAL                                                 273
         61        DO_ICALL                                         $24     
         62      > JMPZ                                                     $24, ->65
   14    63    > > RETURN                                                   !2
   13    64*       JMP                                                      ->92
   15    65    >   INIT_FCALL                                               'filter_var'
         66        SEND_VAR                                                 !2
         67        SEND_VAL                                                 274
         68        DO_ICALL                                         $25     
         69      > JMPZ                                                     $25, ->72
   16    70    > > RETURN                                                   !2
   15    71*       JMP                                                      ->92
   17    72    >   INIT_FCALL                                               'filter_var'
         73        SEND_VAR                                                 !2
         74        SEND_VAL                                                 275
         75        DO_ICALL                                         $26     
         76      > JMPZ                                                     $26, ->79
   18    77    > > RETURN                                                   !2
   17    78*       JMP                                                      ->92
   19    79    >   INIT_FCALL                                               'filter_var'
         80        SEND_VAR                                                 !2
         81        SEND_VAL                                                 259
         82        DO_ICALL                                         $27     
         83      > JMPZ                                                     $27, ->86
   20    84    > > RETURN                                                   !2
   19    85*       JMP                                                      ->92
   22    86    >   INIT_FCALL                                               'preg_replace'
         87        SEND_VAL                                                 '%40%28%5Cp%7BC%7D%29%40ui'
         88        SEND_VAL                                                 ''
         89        SEND_VAR                                                 !2
         90        DO_ICALL                                         $28     
         91      > RETURN                                                   $28
   12    92*       JMP                                                      ->93
   24    93    > > RETURN                                                   null

End of function get

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
147.86 ms | 1022 KiB | 20 Q