עבור לתוכן

ספירת מספר החזרות במערך

Featured Replies

פורסם

 

שלום

אני רוצה לכתוב תוכנית שתיקח טקסט תמיר אותו למערך ואז תיצור מערך נוסף שכולל את המילה ואת מספר הפעמים שהמילה מופיע במערך אז עשיתי ככה:

[FONT=Arial]$arr = "Amid all the diplomatic wrangling, it is Ukrainians who are most directly affected. And they hardly are speaking with one voice.Furor in the western part of the country over Yanukovych, his powers and his bringing Ukraine closer to Russia led to his ouster. Now, most people here support the new government and oppose Russian intervention, as well as the prospect of Crimea becoming part of Russia.[/FONT]
[FONT=Arial]The sentiment tends to be very different in Crimea -- which was part of Russia until being given to Ukraine in 1954 by Soviet leader Nikita Kruschev -- and other parts of southern and eastern Ukraine.[/FONT]
[FONT=Arial]Late last month, the parliament in Crimea installed a new, pro-Moscow government late last month -- as armed, pro-Russian men besieged the parliament building -- and does not recognize the authorities in Kiev.[/FONT]
[FONT=Arial]Citizens will be allowed to vote on March 16 on whether they want an autonomous republic of Crimea within Russia; or within Ukraine.[/FONT]
[FONT=Arial]The autonomous region has a 60% ethnic Russian population, having been part of Russia until it was ceded to Ukraine in 1954 by the Soviet Union. But not everyone may be as keen on coming under Moscow's direct influence. About 25% of the peninsula's population is Ukrainian and about 12% is Crimean Tatar, a predominantly Muslim group.[/FONT]
[FONT=Arial]As riot police looked on, hundreds gathered Thursday in the southern port city of Odessa under the flag of the former Soviet Union calling for unity with Russia.[/FONT]
[FONT=Arial]We are all standing here for Russia, one masked protester told CNN's Matthew Chance. None of us wants to be part of the European Union.[/FONT]
[FONT=Arial]Late Thursday, the management of the hotel in the Crimean capital of Simferopol where CNN has been based told the network to stop broadcasting from there. Other media outlets got the same message, and no reason was given.[/FONT]
[FONT=Arial]Not everyone in this region wants to become part of Russia. Protesters, including one topless woman who was dragged away screaming, railed against the Crimean parliament vote and Putin. But they were drowned out by a heckling, pro-Russian crowd.[/FONT]
[FONT=Arial]Alex Shiroki, from Yalta, said that his boss asked him, point-blank, Are you for Ukraine or for Russia? Whwile his boss favors the latter, Shiroki does not, saying he'd probably leave if Crimea ends up splitting from Ukraine.[/FONT]
[FONT=Arial]U.S. paves way for sanctions on Russians, Ukrainians over Crimea[/FONT]
[FONT=Arial]Michael Crawford, a former British ambassador in Eastern Europe, said that may not happen -- at least easily or peacefully -- even if voters support such a split in the upcoming referendum.[/FONT]
[FONT=Arial]For Russia to start cherry-picking bits of the former Soviet Union, cranking up referenda in Kazakhstan or Latvia or wherever you like, to try to carve off bits, would be against international law, Crawford said, And it would be something Vladimir Putin has said he doesn't want to do.[/FONT]
[FONT=Arial]Yatsenyuk said that if Ukraine is broken up, the world will have trouble ever getting another country to give up its nuclear weapons program.[/FONT]
[FONT=Arial]Why? In 1994, Ukraine agreed to give up its Soviet-era nuclear arsenal in return for guarantees -- signed by the United States, the United Kingdom and Russia -- of its territorial integrity and independence.[/FONT]
[FONT=Arial]What happens now to Ukraine will have an impact on nuclear nonproliferation programs, Yatsenyuk said.";[/FONT]


[FONT=Arial]$newarr =explode(" " ,$arr);[/FONT]
[FONT=Arial] $newArray = array();[/FONT]


[FONT=Arial]$newArray = (array_count_values($newarr));[/FONT]
[FONT=Arial]arsort($newArray);[/FONT]
[FONT=Arial]print_r($newArray);[/FONT]

הקטע זה שאני רוצה לעשות את זה בלי הפונקציה array_count_values אלה עם לולאת for

אשמח לסיוע

נערך על-ידי asaf556

פורסם

הקוד שלך בלתי קריא. תערוך בבקשה את ההודעה ותדביק את הקוד בלי כל סימוני העיצוב (אתה יכול ללחוץ על כפתור "הסר תבנית").

חוץ מזה תערוך את הכותרת ותציין באיזו שפה אתה כותב.

ארכיון

דיון זה הועבר לארכיון ולא ניתן להוסיף בו תגובות חדשות.

דיונים חדשים