Reply to Re: split string or create an array

Your name:

Reply:


Posted by Kim Andrι Akerψ on 10/21/05 17:42

Zoe Brown wrote:

>
> "Siv Hansen" <sivh@broadpark.no> wrote in message
> news:4358e8c1$1@news.broadpark.no...
> > Zoe Brown wrote:
> > > Hello
> > >
> > > I have a string that looks like this "Option 1 - 0086~Option 1 -
> > > 0086~Option 1 - 0086~Option 1 - 0086~"
> > >
> > > I want to split the sting around the "~" or create an array fo
> > > strings so that I can spit out each of the indicvidual values.
> > >
> > > I am new to PHP and cant seem to find the answer.
> > >
> > > Thanks
> > >
> > > Zoe
> > you can use $array= explode('~', $the_string_you_want_to_separate);
> > where parameters to explode is (Stringseparator,
> > string_to_separate_into_an_array)
>
> what is the difference between the explode or the split method ?

From the manual:

split -- Split string into array by regular expression
explode -- Split a string by string

You can use regex with split(), unlike explode(), which only uses a
plain string to split the target string with.

--
Kim AndrΓ© AkerΓΈ
- kimandre@NOSPAMbetadome.com
(remove NOSPAM to contact me directly)

[Back to original message]


УдалСнная Ρ€Π°Π±ΠΎΡ‚Π° для программистов  •  Как Π·Π°Ρ€Π°Π±ΠΎΡ‚Π°Ρ‚ΡŒ Π½Π° Google AdSense  •  England, UK  •  ΡΡ‚Π°Ρ‚ΡŒΠΈ Π½Π° английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Π‘Π°ΠΉΡ‚ ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ Π² Π‘Ρ‚ΡƒΠ΄ΠΈΠΈ Π’Π°Π»Π΅Π½Ρ‚ΠΈΠ½Π° ΠŸΠ΅Ρ‚Ρ€ΡƒΡ‡Π΅ΠΊΠ°
ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ΠΈΠ΅ ΠΈ ΠΏΠΎΠ΄Π΄Π΅Ρ€ΠΆΠΊΠ° Π²Π΅Π±-сайтов, Ρ€Π°Π·Ρ€Π°Π±ΠΎΡ‚ΠΊΠ° ΠΏΡ€ΠΎΠ³Ρ€Π°ΠΌΠΌΠ½ΠΎΠ³ΠΎ обСспСчСния, поисковая оптимизация