3v4l.org

run code in 500+ PHP versions simultaneously
<?php $number = ['1,2', 1, '']; foreach ($number as $val) { if (!empty($val) || !ctype_alpha($val)) echo "val: $val is_numeric ".is_numeric(number_format($val))."\n\r"; } $number = 'abc1,2def'; $number = preg_replace("/[a-zA-Z]/i", '', $number); echo 'is numeric? '.is_numeric(number_format($number));
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 23
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 23
Branch analysis from position: 3
2 jumps found. (Code = 47) Position 1 = 6, Position 2 = 11
Branch analysis from position: 6
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 22
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 22
Branch analysis from position: 11
Branch analysis from position: 23
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 23
filename:       /in/5MXYR
function name:  (null)
number of ops:  35
compiled vars:  !0 = $number, !1 = $val
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, <array>
    4     1      > FE_RESET_R                                           $3      !0, ->23
          2    > > FE_FETCH_R                                                   $3, !1, ->23
    5     3    >   ISSET_ISEMPTY_CV                                     ~4      !1
          4        BOOL_NOT                                             ~5      ~4
          5      > JMPNZ_EX                                             ~5      ~5, ->11
          6    >   INIT_FCALL                                                   'ctype_alpha'
          7        SEND_VAR                                                     !1
          8        DO_ICALL                                             $6      
          9        BOOL_NOT                                             ~7      $6
         10        BOOL                                                 ~5      ~7
         11    > > JMPZ                                                         ~5, ->22
         12    >   ROPE_INIT                                         3  ~9      'val%3A+'
         13        ROPE_ADD                                          1  ~9      ~9, !1
         14        ROPE_END                                          2  ~8      ~9, '+is_numeric+'
         15        INIT_FCALL                                                   'number_format'
         16        SEND_VAR                                                     !1
         17        DO_ICALL                                             $11     
         18        FRAMELESS_ICALL_1                is_numeric          ~12     $11
         19        CONCAT                                               ~13     ~8, ~12
         20        CONCAT                                               ~14     ~13, '%0A%0D'
         21        ECHO                                                         ~14
    4    22    > > JMP                                                          ->2
         23    >   FE_FREE                                                      $3
    8    24        ASSIGN                                                       !0, 'abc1%2C2def'
    9    25        FRAMELESS_ICALL_3                preg_replace        ~16     '%2F%5Ba-zA-Z%5D%2Fi', ''
         26        OP_DATA                                                      !0
         27        ASSIGN                                                       !0, ~16
   10    28        INIT_FCALL                                                   'number_format'
         29        SEND_VAR                                                     !0
         30        DO_ICALL                                             $18     
         31        FRAMELESS_ICALL_1                is_numeric          ~19     $18
         32        CONCAT                                               ~20     'is+numeric%3F+', ~19
         33        ECHO                                                         ~20
         34      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
166.67 ms | 2848 KiB | 15 Q