3v4l.org

run code in 300+ PHP versions simultaneously
<?php function ReformatPhoneNumber($number) { if(strlen($number) > 12 || strlen($number) < 7) throw new Exception("Invalid phone number"); if(preg_match('/^\d+(\d-\d)?\d*(\d\s\d)?\d+$/', $number) === 1) return str_replace(array('-', ' '), '', $number); } //echo ReformatPhoneNumber('012345'); function MaxArray($arr) { $max = 0; foreach($arr as $element) { if(is_array($element)) $max = MaxArray($element) > $max ? MaxArray($element) : $max; else $max = $element > $max ? $element : $max; } return $max; } $arr = array(array(141,151,161), 2, 3, array(101, 202, array(303,404))); echo MaxArray($arr); echo explode("", "Hello");
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/sMpBb
function name:  (null)
number of ops:  11
compiled vars:  !0 = $arr
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   ASSIGN                                                   !0, <array>
   25     1        INIT_FCALL                                               'maxarray'
          2        SEND_VAR                                                 !0
          3        DO_FCALL                                      0  $2      
          4        ECHO                                                     $2
   27     5        INIT_FCALL                                               'explode'
          6        SEND_VAL                                                 ''
          7        SEND_VAL                                                 'Hello'
          8        DO_ICALL                                         $3      
          9        ECHO                                                     $3
         10      > RETURN                                                   1

Function reformatphonenumber:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 47) Position 1 = 4, Position 2 = 7
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 12
Branch analysis from position: 8
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 12
2 jumps found. (Code = 43) Position 1 = 18, Position 2 = 24
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 24
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
filename:       /in/sMpBb
function name:  ReformatPhoneNumber
number of ops:  25
compiled vars:  !0 = $number
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        STRLEN                                           ~1      !0
          2        IS_SMALLER                                       ~2      12, ~1
          3      > JMPNZ_EX                                         ~2      ~2, ->7
          4    >   STRLEN                                           ~3      !0
          5        IS_SMALLER                                       ~4      ~3, 7
          6        BOOL                                             ~2      ~4
          7    > > JMPZ                                                     ~2, ->12
    5     8    >   NEW                                              $5      'Exception'
          9        SEND_VAL_EX                                              'Invalid+phone+number'
         10        DO_FCALL                                      0          
         11      > THROW                                         0          $5
    6    12    >   INIT_FCALL                                               'preg_match'
         13        SEND_VAL                                                 '%2F%5E%5Cd%2B%28%5Cd-%5Cd%29%3F%5Cd%2A%28%5Cd%5Cs%5Cd%29%3F%5Cd%2B%24%2F'
         14        SEND_VAR                                                 !0
         15        DO_ICALL                                         $7      
         16        IS_IDENTICAL                                             $7, 1
         17      > JMPZ                                                     ~8, ->24
    7    18    >   INIT_FCALL                                               'str_replace'
         19        SEND_VAL                                                 <array>
         20        SEND_VAL                                                 ''
         21        SEND_VAR                                                 !0
         22        DO_ICALL                                         $9      
         23      > RETURN                                                   $9
    8    24    > > RETURN                                                   null

End of function reformatphonenumber

Function maxarray:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 26
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 26
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 19
Branch analysis from position: 6
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 16
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 25
Branch analysis from position: 25
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 25
Branch analysis from position: 25
Branch analysis from position: 19
2 jumps found. (Code = 43) Position 1 = 21, Position 2 = 23
Branch analysis from position: 21
1 jumps found. (Code = 42) Position 1 = 24
Branch analysis from position: 24
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 23
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 26
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 26
filename:       /in/sMpBb
function name:  MaxArray
number of ops:  29
compiled vars:  !0 = $arr, !1 = $max, !2 = $element
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   RECV                                             !0      
   13     1        ASSIGN                                                   !1, 0
   14     2      > FE_RESET_R                                       $4      !0, ->26
          3    > > FE_FETCH_R                                               $4, !2, ->26
   15     4    >   TYPE_CHECK                                  128          !2
          5      > JMPZ                                                     ~5, ->19
   16     6    >   INIT_FCALL_BY_NAME                                       'MaxArray'
          7        SEND_VAR_EX                                              !2
          8        DO_FCALL                                      0  $6      
          9        IS_SMALLER                                               !1, $6
         10      > JMPZ                                                     ~7, ->16
         11    >   INIT_FCALL_BY_NAME                                       'MaxArray'
         12        SEND_VAR_EX                                              !2
         13        DO_FCALL                                      0  $8      
         14        QM_ASSIGN                                        ~9      $8
         15      > JMP                                                      ->17
         16    >   QM_ASSIGN                                        ~9      !1
         17    >   ASSIGN                                                   !1, ~9
         18      > JMP                                                      ->25
   18    19    >   IS_SMALLER                                               !1, !2
         20      > JMPZ                                                     ~11, ->23
         21    >   QM_ASSIGN                                        ~12     !2
         22      > JMP                                                      ->24
         23    >   QM_ASSIGN                                        ~12     !1
         24    >   ASSIGN                                                   !1, ~12
   14    25    > > JMP                                                      ->3
         26    >   FE_FREE                                                  $4
   20    27      > RETURN                                                   !1
   21    28*     > RETURN                                                   null

End of function maxarray

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
168.79 ms | 1398 KiB | 20 Q