Обсуждение: Splitting strings
How would you split a string which is seperated by * with PHP? Like "abc*def*ghi" into "abc","def","ghi"? Any clues? Thanks in advance :)
http://www.php.net/manual/en/function.explode.php : How would you split a string which is seperated by * with PHP? : : Like "abc*def*ghi" into "abc","def","ghi"? : : Any clues? Thanks in advance :) : : : ---------------------------(end of broadcast)--------------------------- : TIP 4: Don't 'kill -9' the postmaster
On Mon, Apr 23, 2001 at 05:53:08PM +0200, Christian Marschalek wrote:
> How would you split a string which is seperated by * with PHP?
>
> Like "abc*def*ghi" into "abc","def","ghi"?
$origString = "abc*def*ghi";
$tokens = explode("*",$origString);
$token[0] ---> abc
$token[1] ---> def
...
-Roberto
--
+----| http://fslc.usu.edu USU Free Software & GNU/Linux Club |------+
Roberto Mello - Computer Science, USU - http://www.brasileiro.net
http://www.sdl.usu.edu - Space Dynamics Lab, Developer
Sir -- My first job was programming binary load lifter.
---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
try
array = explode("*", "abc*def*ghi");
That will put it into and array called array with 3 parts to it.
"Christian Marschalek" <cm@chello.at>@postgresql.org on 04/23/2001 11:53:08
AM
Sent by: pgsql-php-owner@postgresql.org
To: "[PHP] PostgreSQL" <pgsql-php@postgresql.org>
cc:
Subject: Splitting strings
How would you split a string which is seperated by * with PHP?
Like "abc*def*ghi" into "abc","def","ghi"?
Any clues? Thanks in advance :)
---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster
---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?
http://www.postgresql.org/search.mpl
Thanks to all for your fast answers! You know who you are :)
Use the function "split". Adam Lang Systems Engineer Rutgers Casualty Insurance Company http://www.rutgersinsurance.com ----- Original Message ----- From: "Christian Marschalek" <cm@chello.at> To: "[PHP] PostgreSQL" <pgsql-php@postgresql.org> Sent: Monday, April 23, 2001 11:53 AM Subject: [PHP] Splitting strings > How would you split a string which is seperated by * with PHP? > > Like "abc*def*ghi" into "abc","def","ghi"? > > Any clues? Thanks in advance :) > > > ---------------------------(end of broadcast)--------------------------- > TIP 4: Don't 'kill -9' the postmaster
On Mon, Apr 23, 2001 at 05:53:08PM +0200, Christian Marschalek wrote:
> How would you split a string which is seperated by * with PHP?
>
> Like "abc*def*ghi" into "abc","def","ghi"?
$origString = "abc*def*ghi";
$tokens = explode("*",$origString);
$token[0] ---> abc
$token[1] ---> def
...
-Roberto
--
+----| http://fslc.usu.edu USU Free Software & GNU/Linux Club |------+
Roberto Mello - Computer Science, USU - http://www.brasileiro.net
http://www.sdl.usu.edu - Space Dynamics Lab, Developer
Sir -- My first job was programming binary load lifter.
---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
try
array = explode("*", "abc*def*ghi");
That will put it into and array called array with 3 parts to it.
"Christian Marschalek" <cm@chello.at>@postgresql.org on 04/23/2001 11:53:08
AM
Sent by: pgsql-php-owner@postgresql.org
To: "[PHP] PostgreSQL" <pgsql-php@postgresql.org>
cc:
Subject: Splitting strings
How would you split a string which is seperated by * with PHP?
Like "abc*def*ghi" into "abc","def","ghi"?
Any clues? Thanks in advance :)
---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster
---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?
http://www.postgresql.org/search.mpl