3v4l.org

run code in 300+ PHP versions simultaneously
<?php $schema = Array( Array("prestation_1" => 123, "prestataire_1" => 321, "prestation_2" => 456, "prestataire_2" => 654), Array("prestation_1" => 123, "prestataire_1" => 321, "prestation_2" => 456, "prestataire_2" => 654), Array("prestation_1" => 123, "prestataire_1" => 3241, "prestation_2" => 4956, "prestataire_2" => 654), Array("prestation_1" => 123, "prestataire_1" => 321, "prestation_2" => 456, "prestataire_2" => 654) ); function check( $array) { $array=array_values($array); $k=0; for($i=0;$i<count($array);$i++) { if(count($array)-1 > $i) { if($array[$i] == $array[$i+1]) $k=0; else $k=1; } } if($k == 0) return $array[0]; else return array(); } print_r(check($schema)) ;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/JQpfo
function name:  (null)
number of ops:  8
compiled vars:  !0 = $schema
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
   30     1        INIT_FCALL                                               'print_r'
          2        INIT_FCALL                                               'check'
          3        SEND_VAR                                                 !0
          4        DO_FCALL                                      0  $2      
          5        SEND_VAR                                                 $2
          6        DO_ICALL                                                 
          7      > RETURN                                                   1

Function check:
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 = 8
Branch analysis from position: 24
2 jumps found. (Code = 43) Position 1 = 26, Position 2 = 29
Branch analysis from position: 26
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 29
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 20
Branch analysis from position: 12
2 jumps found. (Code = 43) Position 1 = 17, Position 2 = 19
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 20
Branch analysis from position: 20
2 jumps found. (Code = 44) Position 1 = 24, Position 2 = 8
Branch analysis from position: 24
Branch analysis from position: 8
Branch analysis from position: 19
2 jumps found. (Code = 44) Position 1 = 24, Position 2 = 8
Branch analysis from position: 24
Branch analysis from position: 8
Branch analysis from position: 20
filename:       /in/JQpfo
function name:  check
number of ops:  31
compiled vars:  !0 = $array, !1 = $k, !2 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV                                             !0      
   11     1        INIT_FCALL                                               'array_values'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $3      
          4        ASSIGN                                                   !0, $3
   12     5        ASSIGN                                                   !1, 0
   13     6        ASSIGN                                                   !2, 0
          7      > JMP                                                      ->21
   15     8    >   COUNT                                            ~7      !0
          9        SUB                                              ~8      ~7, 1
         10        IS_SMALLER                                               !2, ~8
         11      > JMPZ                                                     ~9, ->20
   17    12    >   FETCH_DIM_R                                      ~10     !0, !2
         13        ADD                                              ~11     !2, 1
         14        FETCH_DIM_R                                      ~12     !0, ~11
         15        IS_EQUAL                                                 ~10, ~12
         16      > JMPZ                                                     ~13, ->19
   18    17    >   ASSIGN                                                   !1, 0
         18      > JMP                                                      ->20
   20    19    >   ASSIGN                                                   !1, 1
   13    20    >   PRE_INC                                                  !2
         21    >   COUNT                                            ~17     !0
         22        IS_SMALLER                                               !2, ~17
         23      > JMPNZ                                                    ~18, ->8
   23    24    >   IS_EQUAL                                                 !1, 0
         25      > JMPZ                                                     ~19, ->29
   24    26    >   FETCH_DIM_R                                      ~20     !0, 0
         27      > RETURN                                                   ~20
         28*       JMP                                                      ->30
   26    29    > > RETURN                                                   <array>
   27    30*     > RETURN                                                   null

End of function check

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150.39 ms | 1403 KiB | 18 Q