3v4l.org

run code in 500+ PHP versions simultaneously
<?php function twoNumberSum ( $inputArray, $targetSum ) { $res = []; foreach($inputArray as $i => $firstVal){ array_shift($inputArray); foreach($inputArray as $secVal){ if ( $firstVal + $secVal == $targetSum ) { $res[] = [$firstVal,$secVal] ; } } } return $res; } $numArray = [3,5,-4,8,11,1,-1,6]; $targetSum = 4; var_export( twoNumberSum( $numArray, $targetSum ) );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/lMJTt
function name:  (null)
number of ops:  10
compiled vars:  !0 = $numArray, !1 = $targetSum
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   16     0  E >   ASSIGN                                                       !0, <array>
   17     1        ASSIGN                                                       !1, 4
   19     2        INIT_FCALL                                                   'var_export'
          3        INIT_FCALL                                                   'twonumbersum'
          4        SEND_VAR                                                     !0
          5        SEND_VAR                                                     !1
          6        DO_FCALL                                          0  $4      
          7        SEND_VAR                                                     $4
          8        DO_ICALL                                                     
          9      > RETURN                                                       1

Function twonumbersum:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 21
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 21
Branch analysis from position: 5
2 jumps found. (Code = 77) Position 1 = 10, Position 2 = 19
Branch analysis from position: 10
2 jumps found. (Code = 78) Position 1 = 11, Position 2 = 19
Branch analysis from position: 11
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 18
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
Branch analysis from position: 18
Branch analysis from position: 19
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 19
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 21
filename:       /in/lMJTt
function name:  twoNumberSum
number of ops:  24
compiled vars:  !0 = $inputArray, !1 = $targetSum, !2 = $res, !3 = $firstVal, !4 = $i, !5 = $secVal
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
    4     2        ASSIGN                                                       !2, <array>
    5     3      > FE_RESET_R                                           $7      !0, ->21
          4    > > FE_FETCH_R                                           ~8      $7, !3, ->21
          5    >   ASSIGN                                                       !4, ~8
    6     6        INIT_FCALL                                                   'array_shift'
          7        SEND_REF                                                     !0
          8        DO_ICALL                                                     
    7     9      > FE_RESET_R                                           $11     !0, ->19
         10    > > FE_FETCH_R                                                   $11, !5, ->19
    8    11    >   ADD                                                  ~12     !3, !5
         12        IS_EQUAL                                                     !1, ~12
         13      > JMPZ                                                         ~13, ->18
    9    14    >   INIT_ARRAY                                           ~15     !3
         15        ADD_ARRAY_ELEMENT                                    ~15     !5
         16        ASSIGN_DIM                                                   !2
         17        OP_DATA                                                      ~15
    7    18    > > JMP                                                          ->10
         19    >   FE_FREE                                                      $11
    5    20      > JMP                                                          ->4
         21    >   FE_FREE                                                      $7
   13    22      > RETURN                                                       !2
   14    23*     > RETURN                                                       null

End of function twonumbersum

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
205.29 ms | 1915 KiB | 16 Q