3v4l.org

run code in 300+ PHP versions simultaneously
<?php $tests = array(array(0, .1), array(1, 'foo'), array(.24, -.25), array(3, 3), array('foo', 'bar'), array(-0, 0.1), array(90, -90), array(0, 0), array(1, 1)); foreach ($tests as $test) { echo "Raw: {$test[0]} -vs- {$test[1]} , "; $nums = array((float)$test[0],(float)$test[1]); // force input values to float values echo "FloatVals: {$nums[0]} -vs- {$nums[1]} , "; $nums = array_filter($nums, function($v){ return $v > 0;}); // check if greater than 0 if (empty($nums)) { $price = 'error'; //use die(), but I won't for demonstration } else { $price = min($nums); // declare lowest qualifying price } echo "Output: $price\n"; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 45
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 45
Branch analysis from position: 3
2 jumps found. (Code = 43) Position 1 = 34, Position 2 = 36
Branch analysis from position: 34
1 jumps found. (Code = 42) Position 1 = 40
Branch analysis from position: 40
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 36
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 45
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 45
filename:       /in/fCJ3T
function name:  (null)
number of ops:  47
compiled vars:  !0 = $tests, !1 = $test, !2 = $nums, !3 = $price
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
    3     1      > FE_RESET_R                                       $5      !0, ->45
          2    > > FE_FETCH_R                                               $5, !1, ->45
    4     3    >   ROPE_INIT                                     5  ~9      'Raw%3A+'
          4        FETCH_DIM_R                                      ~6      !1, 0
          5        ROPE_ADD                                      1  ~9      ~9, ~6
          6        ROPE_ADD                                      2  ~9      ~9, '+-vs-+'
          7        FETCH_DIM_R                                      ~7      !1, 1
          8        ROPE_ADD                                      3  ~9      ~9, ~7
          9        ROPE_END                                      4  ~8      ~9, '+%2C+'
         10        ECHO                                                     ~8
    5    11        FETCH_DIM_R                                      ~12     !1, 0
         12        CAST                                          5  ~13     ~12
         13        INIT_ARRAY                                       ~14     ~13
         14        FETCH_DIM_R                                      ~15     !1, 1
         15        CAST                                          5  ~16     ~15
         16        ADD_ARRAY_ELEMENT                                ~14     ~16
         17        ASSIGN                                                   !2, ~14
    6    18        ROPE_INIT                                     5  ~21     'FloatVals%3A+'
         19        FETCH_DIM_R                                      ~18     !2, 0
         20        ROPE_ADD                                      1  ~21     ~21, ~18
         21        ROPE_ADD                                      2  ~21     ~21, '+-vs-+'
         22        FETCH_DIM_R                                      ~19     !2, 1
         23        ROPE_ADD                                      3  ~21     ~21, ~19
         24        ROPE_END                                      4  ~20     ~21, '+%2C+'
         25        ECHO                                                     ~20
    7    26        INIT_FCALL                                               'array_filter'
         27        SEND_VAR                                                 !2
         28        DECLARE_LAMBDA_FUNCTION                          ~24     [0]
         29        SEND_VAL                                                 ~24
         30        DO_ICALL                                         $25     
         31        ASSIGN                                                   !2, $25
    8    32        ISSET_ISEMPTY_CV                                         !2
         33      > JMPZ                                                     ~27, ->36
    9    34    >   ASSIGN                                                   !3, 'error'
    8    35      > JMP                                                      ->40
   11    36    >   INIT_FCALL                                               'min'
         37        SEND_VAR                                                 !2
         38        DO_ICALL                                         $29     
         39        ASSIGN                                                   !3, $29
   13    40    >   ROPE_INIT                                     3  ~32     'Output%3A+'
         41        ROPE_ADD                                      1  ~32     ~32, !3
         42        ROPE_END                                      2  ~31     ~32, '%0A'
         43        ECHO                                                     ~31
    3    44      > JMP                                                      ->2
         45    >   FE_FREE                                                  $5
   14    46      > RETURN                                                   1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fCJ3T
function name:  {closure}
number of ops:  4
compiled vars:  !0 = $v
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
          1        IS_SMALLER                                       ~1      0, !0
          2      > RETURN                                                   ~1
          3*     > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
136.67 ms | 1006 KiB | 15 Q