3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string = "this is my my word with new word"; //echo count(str_word_count($string)); echo unique_word_count($string); function unique_word_count($string) { //$string = explode(' ', strtolower($string)); $string = str_word_count($string); $words = array_unique($string); return count($words); }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/iGS19
function name:  (null)
number of ops:  6
compiled vars:  !0 = $string
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   ASSIGN                                                   !0, 'this+is+my+my+word+with+new+word'
    6     1        INIT_FCALL_BY_NAME                                       'unique_word_count'
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0  $2      
          4        ECHO                                                     $2
   13     5      > RETURN                                                   1

Function unique_word_count:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/iGS19
function name:  unique_word_count
number of ops:  12
compiled vars:  !0 = $string, !1 = $words
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
   10     1        INIT_FCALL                                               'str_word_count'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $2      
          4        ASSIGN                                                   !0, $2
   11     5        INIT_FCALL                                               'array_unique'
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                         $4      
          8        ASSIGN                                                   !1, $4
   12     9        COUNT                                            ~6      !1
         10      > RETURN                                                   ~6
   13    11*     > RETURN                                                   null

End of function unique_word_count

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
181.48 ms | 1395 KiB | 17 Q