3v4l.org

run code in 300+ PHP versions simultaneously
<?php function array_same_values($array) { return array_unique($array,SORT_REGULAR) !== $array; } /* テスト - 重複なし */ $array1 = array('foo', 'bar', 'baz', 'qux'); var_dump(array_same_values($array1)); //false /* テスト - 重複あり */ $array2 = array('foo', 'bar', 'baz', 'foo'); var_dump(array_same_values($array2)); // true /* テスト - 重複あり(数値と数値文字列) */ $array3 = array('foo', 'bar', 'baz', 'qux', '1', 1); var_dump(array_same_values($array3)); // true
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/cHORK
function name:  (null)
number of ops:  22
compiled vars:  !0 = $array1, !1 = $array2, !2 = $array3
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   ASSIGN                                                   !0, <array>
    9     1        INIT_FCALL                                               'var_dump'
          2        INIT_FCALL                                               'array_same_values'
          3        SEND_VAR                                                 !0
          4        DO_FCALL                                      0  $4      
          5        SEND_VAR                                                 $4
          6        DO_ICALL                                                 
   12     7        ASSIGN                                                   !1, <array>
   13     8        INIT_FCALL                                               'var_dump'
          9        INIT_FCALL                                               'array_same_values'
         10        SEND_VAR                                                 !1
         11        DO_FCALL                                      0  $7      
         12        SEND_VAR                                                 $7
         13        DO_ICALL                                                 
   16    14        ASSIGN                                                   !2, <array>
   17    15        INIT_FCALL                                               'var_dump'
         16        INIT_FCALL                                               'array_same_values'
         17        SEND_VAR                                                 !2
         18        DO_FCALL                                      0  $10     
         19        SEND_VAR                                                 $10
         20        DO_ICALL                                                 
         21      > RETURN                                                   1

Function array_same_values:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/cHORK
function name:  array_same_values
number of ops:  8
compiled vars:  !0 = $array
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        INIT_FCALL                                               'array_unique'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 0
          4        DO_ICALL                                         $1      
          5        IS_NOT_IDENTICAL                                 ~2      !0, $1
          6      > RETURN                                                   ~2
    5     7*     > RETURN                                                   null

End of function array_same_values

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
169.73 ms | 1398 KiB | 20 Q