3v4l.org

run code in 300+ PHP versions simultaneously
<?php function any($elements, Clousure $x){ foreach($elements as $element){ if($x($element)) return true; } return false; } function all($elements, Clousure $x){ foreach($elements as $element){ if(!$x($element)) return false; } return true; } function minimum($of) { return function($el) use ($of){ if($el < $of) return true; return false; }; } echo "any x <- [1, 2, 3, 4, 5] | < 5" . PHP_EOL; if(any(array(1, 2, 3, 4, 5), minimum(5))) { echo "true" . PHP_EOL; } else { echo "false" . PHP_EOL; }; echo "all x <- [1, 2, 3, 4] | < 5" . PHP_EOL; if(all(array(1, 2, 3, 4), minimum(5))) { echo "true" . PHP_EOL; } else { echo "false" . PHP_EOL; };
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 11
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
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 = 62) Position 1 = -2
Branch analysis from position: 23
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 11
2 jumps found. (Code = 43) Position 1 = 21, Position 2 = 23
Branch analysis from position: 21
Branch analysis from position: 23
filename:       /in/UUe6i
function name:  (null)
number of ops:  25
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   28     0  E >   ECHO                                                     'any+x+%3C-+%5B1%2C+2%2C+3%2C+4%2C+5%5D+%7C+%3C+5%0A'
   29     1        INIT_FCALL                                               'any'
          2        SEND_VAL                                                 <array>
          3        INIT_FCALL                                               'minimum'
          4        SEND_VAL                                                 5
          5        DO_FCALL                                      0  $0      
          6        SEND_VAR                                                 $0
          7        DO_FCALL                                      0  $1      
          8      > JMPZ                                                     $1, ->11
          9    >   ECHO                                                     'true%0A'
         10      > JMP                                                      ->12
         11    >   ECHO                                                     'false%0A'
   30    12    >   ECHO                                                     'all+x+%3C-+%5B1%2C+2%2C+3%2C+4%5D+%7C+%3C+5%0A'
   31    13        INIT_FCALL                                               'all'
         14        SEND_VAL                                                 <array>
         15        INIT_FCALL                                               'minimum'
         16        SEND_VAL                                                 5
         17        DO_FCALL                                      0  $2      
         18        SEND_VAR                                                 $2
         19        DO_FCALL                                      0  $3      
         20      > JMPZ                                                     $3, ->23
         21    >   ECHO                                                     'true%0A'
         22      > JMP                                                      ->24
         23    >   ECHO                                                     'false%0A'
         24    > > RETURN                                                   1

Function any:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 11
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 11
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 10
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 11
filename:       /in/UUe6i
function name:  any
number of ops:  14
compiled vars:  !0 = $elements, !1 = $x, !2 = $element
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    4     2      > FE_RESET_R                                       $3      !0, ->11
          3    > > FE_FETCH_R                                               $3, !2, ->11
    5     4    >   INIT_DYNAMIC_CALL                                        !1
          5        SEND_VAR_EX                                              !2
          6        DO_FCALL                                      0  $4      
          7      > JMPZ                                                     $4, ->10
          8    >   FE_FREE                                                  $3
          9      > RETURN                                                   <true>
    4    10    > > JMP                                                      ->3
         11    >   FE_FREE                                                  $3
    8    12      > RETURN                                                   <false>
    9    13*     > RETURN                                                   null

End of function any

Function all:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 12
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 12
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 11
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
filename:       /in/UUe6i
function name:  all
number of ops:  15
compiled vars:  !0 = $elements, !1 = $x, !2 = $element
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   12     2      > FE_RESET_R                                       $3      !0, ->12
          3    > > FE_FETCH_R                                               $3, !2, ->12
   13     4    >   INIT_DYNAMIC_CALL                                        !1
          5        SEND_VAR_EX                                              !2
          6        DO_FCALL                                      0  $4      
          7        BOOL_NOT                                         ~5      $4
          8      > JMPZ                                                     ~5, ->11
          9    >   FE_FREE                                                  $3
         10      > RETURN                                                   <false>
   12    11    > > JMP                                                      ->3
         12    >   FE_FREE                                                  $3
   16    13      > RETURN                                                   <true>
   17    14*     > RETURN                                                   null

End of function all

Function minimum:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/UUe6i
function name:  minimum
number of ops:  5
compiled vars:  !0 = $of
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   RECV                                             !0      
   22     1        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FUUe6i%3A22%240'
          2        BIND_LEXICAL                                             ~1, !0
   25     3      > RETURN                                                   ~1
   26     4*     > RETURN                                                   null

End of function minimum

Function %00%7Bclosure%7D%2Fin%2FUUe6i%3A22%240:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 5
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/UUe6i
function name:  {closure}
number of ops:  7
compiled vars:  !0 = $el, !1 = $of
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
   23     2        IS_SMALLER                                               !0, !1
          3      > JMPZ                                                     ~2, ->5
          4    > > RETURN                                                   <true>
   24     5    > > RETURN                                                   <false>
   25     6*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FUUe6i%3A22%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.34 ms | 1407 KiB | 17 Q