3v4l.org

run code in 300+ PHP versions simultaneously
<?php function testAsc($array) { $memory=null; foreach($array as $member) { if ($memory)if($member<=$memory)return false; $memory=$member; } return true; } function solution($array) { for($i=0;$i<count($array);$i++) { $currentArray=array_filter($array, function($index) use($i) { return $i != $index; }, ARRAY_FILTER_USE_KEY); if(testAsc($currentArray)) return implode($currentArray) . "\n"; } return 'nie da sie' . "\n"; } echo solution([1, 2, 3, 4]);//234 echo solution([1, 7, 7, 4]);//nie da sie echo solution([1, 7, 2, 4]);//124
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/2CZ2N
function name:  (null)
number of ops:  13
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   INIT_FCALL                                               'solution'
          1        SEND_VAL                                                 <array>
          2        DO_FCALL                                      0  $0      
          3        ECHO                                                     $0
   22     4        INIT_FCALL                                               'solution'
          5        SEND_VAL                                                 <array>
          6        DO_FCALL                                      0  $1      
          7        ECHO                                                     $1
   23     8        INIT_FCALL                                               'solution'
          9        SEND_VAL                                                 <array>
         10        DO_FCALL                                      0  $2      
         11        ECHO                                                     $2
         12      > RETURN                                                   1

Function testasc:
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 = 5, Position 2 = 9
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 9
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 9
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 11
filename:       /in/2CZ2N
function name:  testAsc
number of ops:  14
compiled vars:  !0 = $array, !1 = $memory, !2 = $member
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
    3     1        ASSIGN                                                   !1, null
    4     2      > FE_RESET_R                                       $4      !0, ->11
          3    > > FE_FETCH_R                                               $4, !2, ->11
    5     4    > > JMPZ                                                     !1, ->9
          5    >   IS_SMALLER_OR_EQUAL                                      !2, !1
          6      > JMPZ                                                     ~5, ->9
          7    >   FE_FREE                                                  $4
          8      > RETURN                                                   <false>
    6     9    >   ASSIGN                                                   !1, !2
    4    10      > JMP                                                      ->3
         11    >   FE_FREE                                                  $4
    8    12      > RETURN                                                   <true>
    9    13*     > RETURN                                                   null

End of function testasc

Function solution:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 21
Branch analysis from position: 21
2 jumps found. (Code = 44) Position 1 = 24, Position 2 = 3
Branch analysis from position: 24
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 3
2 jumps found. (Code = 43) Position 1 = 15, Position 2 = 20
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 20
2 jumps found. (Code = 44) Position 1 = 24, Position 2 = 3
Branch analysis from position: 24
Branch analysis from position: 3
filename:       /in/2CZ2N
function name:  solution
number of ops:  26
compiled vars:  !0 = $array, !1 = $i, !2 = $currentArray
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   RECV                                             !0      
   12     1        ASSIGN                                                   !1, 0
          2      > JMP                                                      ->21
   13     3    >   INIT_FCALL                                               'array_filter'
          4        SEND_VAR                                                 !0
          5        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2F2CZ2N%3A13%240'
          6        BIND_LEXICAL                                             ~4, !1
   15     7        SEND_VAL                                                 ~4
          8        SEND_VAL                                                 2
          9        DO_ICALL                                         $5      
   13    10        ASSIGN                                                   !2, $5
   16    11        INIT_FCALL                                               'testasc'
         12        SEND_VAR                                                 !2
         13        DO_FCALL                                      0  $7      
         14      > JMPZ                                                     $7, ->20
         15    >   INIT_FCALL                                               'implode'
         16        SEND_VAR                                                 !2
         17        DO_ICALL                                         $8      
         18        CONCAT                                           ~9      $8, '%0A'
         19      > RETURN                                                   ~9
   12    20    >   PRE_INC                                                  !1
         21    >   COUNT                                            ~11     !0
         22        IS_SMALLER                                               !1, ~11
         23      > JMPNZ                                                    ~12, ->3
   18    24    > > RETURN                                                   'nie+da+sie%0A'
   19    25*     > RETURN                                                   null

End of function solution

Function %00%7Bclosure%7D%2Fin%2F2CZ2N%3A13%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/2CZ2N
function name:  {closure}
number of ops:  5
compiled vars:  !0 = $index, !1 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
   14     2        IS_NOT_EQUAL                                     ~2      !1, !0
          3      > RETURN                                                   ~2
   15     4*     > RETURN                                                   null

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

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
130.14 ms | 1407 KiB | 21 Q