# BeHappy

New Members

6

0 Neutral

• Rank
Newbie
1. ## Count duplicate adjacent (Array)

Barand 😍🥰 Thank you so much, you are a genius 💗💞
2. ## Count duplicate adjacent (Array)

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. ## Count duplicate adjacent (Array)

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

5. ## Count duplicate adjacent (Array)

Hi, thanks can you give me an example with code please 😇
6. ## Count duplicate adjacent (Array)

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
×

• #### Activity

• Chat
×
• Create New...