Jump to content

BeHappy

New Members
  • Posts

    6
  • Joined

  • Last visited

Everything posted by BeHappy

  1. Barand 😍🥰 Thank you so much, you are a genius 💗💞
  2. I have created this code but i think there's a problem with it <?php $array = array("test", "test", "hello", "test", "world", "world", "world", "hello", "test"); $j=1; for( $i= 0 ; $i <= 7 ;$i++ ){ if ($array[$i] === $array[$i+1]) { echo $j .= $j+1; } else { echo "1"; } }?> output = 1211112131213121411 not 2,1,1,3,1,1 😅
  3. Thank you Barand; This my array $Array = array("test", "test", "hello", "test", "world", "world", "world", "hello", "test"); Well, i would like to show a list with adjacent duplicates for example the word test 2 not 4 duplicates and finally the output will be like this 2,1,1,3,1,1 the problem that array_count_values show the all duplicates, i would like to show the adjacent duplicates
  4. There is no solution for adjacent duplicate in the link !!!
  5. Hi, thanks can you give me an example with code please 😇
  6. Hello; I would like to do the following operation; Count duplicate (adjacent) my code <?php $Array = array("test", "test", "hello", "test", "world", "world", "world", "hello", "test"); for( $i= 0 ; $i <= 6 ;$i++ ) { $j=1; if ($Array[$i] === $Array[$i+1]) { $j+=$j; echo $j; } ?> and showing something like 2,1,1,3,1,1 Thanks
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.