3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = array("station8", "2ndExit", "block9a", "floor5"); echo "<pre>" . __FILE__ . '-->' . __METHOD__ . ':' . __LINE__ . PHP_EOL; var_dump(minMaxNum($arr)); die(); function minMaxNum ($arr = array()) { $min = $max = null; foreach ($arr as $value) { $value = preg_split('/(?<=\d)(?=[a-zA-Z])|(?<=[a-zA-Z])(?=\d)/i', $value); $value = array_filter($value, function ($n){ if(!is_numeric($n)) { unset($n); } else { return $n; } }); foreach($value as $item) { if($min == null && $max == null) { // not initiated $min = $max = $item; } else { if($item < $min) $min = $item; if($item > $max) $max = $item; } } } echo "<pre>" . __FILE__ . '-->' . __METHOD__ . ':' . __LINE__ . PHP_EOL; var_dump($min, $max); die(); }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 79) Position 1 = -2
filename:       /in/Qb6Y7
function name:  (null)
number of ops:  10
compiled vars:  !0 = $arr
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    5     1        ECHO                                                     '%3Cpre%3E%2Fin%2FQb6Y7--%3E%3A5%0A'
    6     2        INIT_FCALL                                               'var_dump'
          3        INIT_FCALL_BY_NAME                                       'minMaxNum'
          4        SEND_VAR_EX                                              !0
          5        DO_FCALL                                      0  $2      
          6        SEND_VAR                                                 $2
          7        DO_ICALL                                                 
    7     8      > EXIT                                                     
   32     9*     > RETURN                                                   1

Function minmaxnum:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 35
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 35
Branch analysis from position: 5
2 jumps found. (Code = 77) Position 1 = 17, Position 2 = 33
Branch analysis from position: 17
2 jumps found. (Code = 78) Position 1 = 18, Position 2 = 33
Branch analysis from position: 18
2 jumps found. (Code = 46) Position 1 = 20, Position 2 = 22
Branch analysis from position: 20
2 jumps found. (Code = 43) Position 1 = 23, Position 2 = 26
Branch analysis from position: 23
1 jumps found. (Code = 42) Position 1 = 32
Branch analysis from position: 32
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
Branch analysis from position: 26
2 jumps found. (Code = 43) Position 1 = 28, Position 2 = 29
Branch analysis from position: 28
2 jumps found. (Code = 43) Position 1 = 31, Position 2 = 32
Branch analysis from position: 31
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
Branch analysis from position: 32
Branch analysis from position: 29
Branch analysis from position: 22
Branch analysis from position: 33
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 33
Branch analysis from position: 35
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 35
filename:       /in/Qb6Y7
function name:  minMaxNum
number of ops:  43
compiled vars:  !0 = $arr, !1 = $min, !2 = $max, !3 = $value, !4 = $item
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV_INIT                                        !0      <array>
   10     1        ASSIGN                                           ~5      !2, null
          2        ASSIGN                                                   !1, ~5
   11     3      > FE_RESET_R                                       $7      !0, ->35
          4    > > FE_FETCH_R                                               $7, !3, ->35
   12     5    >   INIT_FCALL                                               'preg_split'
          6        SEND_VAL                                                 '%2F%28%3F%3C%3D%5Cd%29%28%3F%3D%5Ba-zA-Z%5D%29%7C%28%3F%3C%3D%5Ba-zA-Z%5D%29%28%3F%3D%5Cd%29%2Fi'
          7        SEND_VAR                                                 !3
          8        DO_ICALL                                         $8      
          9        ASSIGN                                                   !3, $8
   13    10        INIT_FCALL                                               'array_filter'
         11        SEND_VAR                                                 !3
         12        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FQb6Y7%3A13%240'
   19    13        SEND_VAL                                                 ~10
         14        DO_ICALL                                         $11     
   13    15        ASSIGN                                                   !3, $11
   20    16      > FE_RESET_R                                       $13     !3, ->33
         17    > > FE_FETCH_R                                               $13, !4, ->33
   21    18    >   IS_EQUAL                                         ~14     !1, null
         19      > JMPZ_EX                                          ~14     ~14, ->22
         20    >   IS_EQUAL                                         ~15     !2, null
         21        BOOL                                             ~14     ~15
         22    > > JMPZ                                                     ~14, ->26
   22    23    >   ASSIGN                                           ~16     !2, !4
         24        ASSIGN                                                   !1, ~16
         25      > JMP                                                      ->32
   24    26    >   IS_SMALLER                                               !4, !1
         27      > JMPZ                                                     ~18, ->29
         28    >   ASSIGN                                                   !1, !4
   25    29    >   IS_SMALLER                                               !2, !4
         30      > JMPZ                                                     ~20, ->32
         31    >   ASSIGN                                                   !2, !4
   20    32    > > JMP                                                      ->17
         33    >   FE_FREE                                                  $13
   11    34      > JMP                                                      ->4
         35    >   FE_FREE                                                  $7
   29    36        ECHO                                                     '%3Cpre%3E%2Fin%2FQb6Y7--%3EminMaxNum%3A29%0A'
   30    37        INIT_FCALL                                               'var_dump'
         38        SEND_VAR                                                 !1
         39        SEND_VAR                                                 !2
         40        DO_ICALL                                                 
   31    41      > EXIT                                                     
   32    42*     > RETURN                                                   null

End of function minmaxnum

Function %00%7Bclosure%7D%2Fin%2FQb6Y7%3A13%240:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 8
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Qb6Y7
function name:  {closure}
number of ops:  10
compiled vars:  !0 = $n
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   RECV                                             !0      
   14     1        INIT_FCALL                                               'is_numeric'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $1      
          4        BOOL_NOT                                         ~2      $1
          5      > JMPZ                                                     ~2, ->8
   15     6    >   UNSET_CV                                                 !0
          7      > JMP                                                      ->9
   17     8    > > RETURN                                                   !0
   19     9    > > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FQb6Y7%3A13%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
177.78 ms | 1404 KiB | 21 Q