3v4l.org

run code in 300+ PHP versions simultaneously
<?php $default = '10px'; $string = trim( strtolower( (string) '-20%x' ) ); if( strpos( $string, 'auto') !== false || strpos( $string, '0') !== false || preg_match( '/[+-]?[0-9]+.?([0-9]+)?(em|ex|%|px|cm|mm|in|pt|pc|ch|rem|vh|vw|vmin|vmax)$/', $string ) ) { echo $string; } else { echo $default; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 47) Position 1 = 15, Position 2 = 21
Branch analysis from position: 15
2 jumps found. (Code = 47) Position 1 = 22, Position 2 = 27
Branch analysis from position: 22
2 jumps found. (Code = 43) Position 1 = 28, Position 2 = 30
Branch analysis from position: 28
1 jumps found. (Code = 42) Position 1 = 31
Branch analysis from position: 31
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 30
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 27
Branch analysis from position: 21
filename:       /in/TKV4O
function name:  (null)
number of ops:  32
compiled vars:  !0 = $default, !1 = $string
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '10px'
    4     1        INIT_FCALL                                               'trim'
          2        INIT_FCALL                                               'strtolower'
          3        CAST                                          6  ~3      '-20%25x'
          4        SEND_VAL                                                 ~3
          5        DO_ICALL                                         $4      
          6        SEND_VAR                                                 $4
          7        DO_ICALL                                         $5      
          8        ASSIGN                                                   !1, $5
    6     9        INIT_FCALL                                               'strpos'
         10        SEND_VAR                                                 !1
         11        SEND_VAL                                                 'auto'
         12        DO_ICALL                                         $7      
         13        TYPE_CHECK                                  1018  ~8      $7
         14      > JMPNZ_EX                                         ~8      ~8, ->21
    7    15    >   INIT_FCALL                                               'strpos'
         16        SEND_VAR                                                 !1
         17        SEND_VAL                                                 '0'
         18        DO_ICALL                                         $9      
         19        TYPE_CHECK                                  1018  ~10     $9
         20        BOOL                                             ~8      ~10
         21    > > JMPNZ_EX                                         ~8      ~8, ->27
    8    22    >   INIT_FCALL                                               'preg_match'
         23        SEND_VAL                                                 '%2F%5B%2B-%5D%3F%5B0-9%5D%2B.%3F%28%5B0-9%5D%2B%29%3F%28em%7Cex%7C%25%7Cpx%7Ccm%7Cmm%7Cin%7Cpt%7Cpc%7Cch%7Crem%7Cvh%7Cvw%7Cvmin%7Cvmax%29%24%2F'
         24        SEND_VAR                                                 !1
         25        DO_ICALL                                         $11     
         26        BOOL                                             ~8      $11
         27    > > JMPZ                                                     ~8, ->30
   10    28    >   ECHO                                                     !1
         29      > JMP                                                      ->31
   12    30    >   ECHO                                                     !0
   13    31    > > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
165.45 ms | 1388 KiB | 21 Q