Re: [PHP] Split string

2007-05-02 Thread Lester Caine

Jim Lucas wrote:


Can someone with a few more working grey cells prompt me with the
correct command to split a string.

The entered data is names, but I need to split the text up to the
first space or comma into one string, and the rest of the string
into
a second. It's the 'first either space or comma' that eludes me at
the
moment :(



This should work for you.



$myString = "Here is my first, attempt!";
$answer = preg_split('|[, ]|', $myString, 2);


Ok having re-read the preg_split manual page and now found a nice crib sheet 
for 'pattern' I can understand that. Although it is not obvious from the 
manual what gets returned if there are two comma's or spaces. I would have 
expected I think that everything after the second match would be lost? As you 
only asked to return the first 2 strings, but the last string does contain all 
the remaining characters :) ( There is a note about it in the comments, but it 
would be nice to include that sort of fine detail in the main explanation.


I've already found the other problem with this simple search selection. 
Originally I just wanted to do "Jones,A" and the above would work fine. But 
some customers said 'We are used to "Jones A" in X - can you do that'. Of 
cause anything is possible in software, hence the original question, except 
where they have actually typed 'JONES A' as the Surname ;)


--
Lester Caine - G8HFL
-
Contact - http://home.lsces.co.uk/lsces/wiki/?page=contact
L.S.Caine Electronic Services - http://home.lsces.co.uk
MEDW - http://home.lsces.co.uk/ModelEngineersDigitalWorkshop/
Firebird Foundation Inc. - http://www.firebirdsql.org/index.php

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Split string

2007-05-02 Thread Richard Lynch


On Wed, May 2, 2007 4:10 pm, Stut wrote:
> Richard Lynch wrote:
>> On Wed, May 2, 2007 4:55 am, Lester Caine wrote:
>>> Fredrik Thunberg wrote:
 Lester Caine skrev:
> Can someone with a few more working grey cells prompt me with the
> correct command to split a string.
>
> The entered data is names, but I need to split the text up to the
> first space or comma into one string, and the rest of the string
> into
> a second. It's the 'first either space or comma' that eludes me
> at
> the
> moment :(
>
> In know it's probably obvious, but it always is when you know the
> answer.
 $myString = "John Doe";

 $pos = strpos($myString, " ") < strpos($myString, ",") ?
 strpos($myString, " ") : strpos($myString, ",");

 $part1 = substr($myString, 0, $pos);
 $part2 = substr($myString, $pos);
>>> I'm glad I asked now, that is a lot nicer than trying to get the
>>> preg_split
>>> thing working :)
>>
>> Hnmmm.  Okay, I'll take a shot at it:
>>
>> $answer = preg_split('|[, ]|', $myString);
>> var_dump($answer);
>
> Will give more than 2 parts for strings containing both or multiples.

Yeah, I definitely missed the limit 2 requirement when I read through
the OP.

Though I don't think the 2 bit was the tricky part of the PREG... :-)

> Now please irradiate your hands.

I think they had that done to them way back when, and that's why I
post so much...  You want me to do it again?

:-)

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Split string

2007-05-02 Thread Edward Vermillion


On May 2, 2007, at 4:10 PM, Stut wrote:


Richard Lynch wrote:

On Wed, May 2, 2007 4:55 am, Lester Caine wrote:

Fredrik Thunberg wrote:

Lester Caine skrev:

Can someone with a few more working grey cells prompt me with the
correct command to split a string.

The entered data is names, but I need to split the text up to the
first space or comma into one string, and the rest of the string
into
a second. It's the 'first either space or comma' that eludes me at
the
moment :(

In know it's probably obvious, but it always is when you know the
answer.

$myString = "John Doe";

$pos = strpos($myString, " ") < strpos($myString, ",") ?
strpos($myString, " ") : strpos($myString, ",");

$part1 = substr($myString, 0, $pos);
$part2 = substr($myString, $pos);

I'm glad I asked now, that is a lot nicer than trying to get the
preg_split
thing working :)

Hnmmm.  Okay, I'll take a shot at it:
$answer = preg_split('|[, ]|', $myString);
var_dump($answer);


Will give more than 2 parts for strings containing both or multiples.

Now please irradiate your hands.



This won't: $answer = preg_split('/(?:,|\s)+/', $myString);

At least not in my tests.

Ed

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Split string

2007-05-02 Thread Jim Lucas

Stut wrote:

Richard Lynch wrote:

On Wed, May 2, 2007 4:55 am, Lester Caine wrote:

Fredrik Thunberg wrote:

Lester Caine skrev:

Can someone with a few more working grey cells prompt me with the
correct command to split a string.

The entered data is names, but I need to split the text up to the
first space or comma into one string, and the rest of the string
into
a second. It's the 'first either space or comma' that eludes me at
the
moment :(

In know it's probably obvious, but it always is when you know the
answer.

$myString = "John Doe";

$pos = strpos($myString, " ") < strpos($myString, ",") ?
strpos($myString, " ") : strpos($myString, ",");

$part1 = substr($myString, 0, $pos);
$part2 = substr($myString, $pos);

I'm glad I asked now, that is a lot nicer than trying to get the
preg_split
thing working :)


Hnmmm.  Okay, I'll take a shot at it:

$answer = preg_split('|[, ]|', $myString);
var_dump($answer);


Will give more than 2 parts for strings containing both or multiples.

Now please irradiate your hands.

-Stut


This should work for you.


--
Enjoy,

Jim Lucas

Different eyes see different things. Different hearts beat on different strings. But there are times 
for you and me when all such things agree.


- Rush

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Split string

2007-05-02 Thread Stut

Richard Lynch wrote:

On Wed, May 2, 2007 4:55 am, Lester Caine wrote:

Fredrik Thunberg wrote:

Lester Caine skrev:

Can someone with a few more working grey cells prompt me with the
correct command to split a string.

The entered data is names, but I need to split the text up to the
first space or comma into one string, and the rest of the string
into
a second. It's the 'first either space or comma' that eludes me at
the
moment :(

In know it's probably obvious, but it always is when you know the
answer.

$myString = "John Doe";

$pos = strpos($myString, " ") < strpos($myString, ",") ?
strpos($myString, " ") : strpos($myString, ",");

$part1 = substr($myString, 0, $pos);
$part2 = substr($myString, $pos);

I'm glad I asked now, that is a lot nicer than trying to get the
preg_split
thing working :)


Hnmmm.  Okay, I'll take a shot at it:

$answer = preg_split('|[, ]|', $myString);
var_dump($answer);


Will give more than 2 parts for strings containing both or multiples.

Now please irradiate your hands.

-Stut

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Split string

2007-05-02 Thread Richard Lynch


On Wed, May 2, 2007 4:55 am, Lester Caine wrote:
> Fredrik Thunberg wrote:
>> Lester Caine skrev:
>>> Can someone with a few more working grey cells prompt me with the
>>> correct command to split a string.
>>>
>>> The entered data is names, but I need to split the text up to the
>>> first space or comma into one string, and the rest of the string
>>> into
>>> a second. It's the 'first either space or comma' that eludes me at
>>> the
>>> moment :(
>>>
>>> In know it's probably obvious, but it always is when you know the
>>> answer.
>>
>> $myString = "John Doe";
>>
>> $pos = strpos($myString, " ") < strpos($myString, ",") ?
>> strpos($myString, " ") : strpos($myString, ",");
>>
>> $part1 = substr($myString, 0, $pos);
>> $part2 = substr($myString, $pos);
>
> I'm glad I asked now, that is a lot nicer than trying to get the
> preg_split
> thing working :)

Hnmmm.  Okay, I'll take a shot at it:

$answer = preg_split('|[, ]|', $myString);
var_dump($answer);

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Split string

2007-05-02 Thread Richard Lynch


On Wed, May 2, 2007 3:55 am, Lester Caine wrote:
> Can someone with a few more working grey cells prompt me with the
> correct
> command to split a string.
>
> The entered data is names, but I need to split the text up to the
> first space
> or comma into one string, and the rest of the string into a second.
> It's the
> 'first either space or comma' that eludes me at the moment :(
>
> In know it's probably obvious, but it always is when you know the
> answer.

One of these should have an example to get you where you need to be:
http://php.net/split
http://php.net/preg_split

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Split string

2007-05-02 Thread Stut

Stut wrote:
Alternatively you could use split to break the string into the two 
parts, which is probably more efficient...


list($part1, $part2) = split('[ ,]', $myString);


Oops, this should have a third parameter...

list($part1, $part2) = split('[ ,]', $myString, 2);

-Stut

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Split string

2007-05-02 Thread Stut

Fredrik Thunberg wrote:

Lester Caine skrev:
Can someone with a few more working grey cells prompt me with the 
correct command to split a string.


The entered data is names, but I need to split the text up to the 
first space or comma into one string, and the rest of the string into 
a second. It's the 'first either space or comma' that eludes me at the 
moment :(


In know it's probably obvious, but it always is when you know the answer.



$myString = "John Doe";

$pos = strpos($myString, " ") < strpos($myString, ",") ? 
strpos($myString, " ") : strpos($myString, ",");


Suggest the following as being more efficient (half the strpos calls)...

$pos = min(strpos($myString, " "), strpos($myString, ","));

Alternatively you could use split to break the string into the two 
parts, which is probably more efficient...


list($part1, $part2) = split('[ ,]', $myString);

-Stut

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Split string

2007-05-02 Thread Lester Caine

Fredrik Thunberg wrote:

Lester Caine skrev:
Can someone with a few more working grey cells prompt me with the 
correct command to split a string.


The entered data is names, but I need to split the text up to the 
first space or comma into one string, and the rest of the string into 
a second. It's the 'first either space or comma' that eludes me at the 
moment :(


In know it's probably obvious, but it always is when you know the answer.


$myString = "John Doe";

$pos = strpos($myString, " ") < strpos($myString, ",") ? 
strpos($myString, " ") : strpos($myString, ",");


$part1 = substr($myString, 0, $pos);
$part2 = substr($myString, $pos);


I'm glad I asked now, that is a lot nicer than trying to get the preg_split 
thing working :)


--
Lester Caine - G8HFL
-
Contact - http://home.lsces.co.uk/lsces/wiki/?page=contact
L.S.Caine Electronic Services - http://home.lsces.co.uk
MEDW - http://home.lsces.co.uk/ModelEngineersDigitalWorkshop/
Firebird Foundation Inc. - http://www.firebirdsql.org/index.php

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Split string

2007-05-02 Thread Fredrik Thunberg

Lester Caine skrev:
Can someone with a few more working grey cells prompt me with the 
correct command to split a string.


The entered data is names, but I need to split the text up to the first 
space or comma into one string, and the rest of the string into a 
second. It's the 'first either space or comma' that eludes me at the 
moment :(


In know it's probably obvious, but it always is when you know the answer.



$myString = "John Doe";

$pos = strpos($myString, " ") < strpos($myString, ",") ? 
strpos($myString, " ") : strpos($myString, ",");


$part1 = substr($myString, 0, $pos);
$part2 = substr($myString, $pos);

/T

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Split string

2007-05-02 Thread Lester Caine
Can someone with a few more working grey cells prompt me with the correct 
command to split a string.


The entered data is names, but I need to split the text up to the first space 
or comma into one string, and the rest of the string into a second. It's the 
'first either space or comma' that eludes me at the moment :(


In know it's probably obvious, but it always is when you know the answer.

--
Lester Caine - G8HFL
-
Contact - http://home.lsces.co.uk/lsces/wiki/?page=contact
L.S.Caine Electronic Services - http://home.lsces.co.uk
MEDW - http://home.lsces.co.uk/ModelEngineersDigitalWorkshop/
Firebird Foundation Inc. - http://www.firebirdsql.org/index.php

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] ? Split string into smaller chunks

2005-12-19 Thread David Grant
Labunski wrote:
> I need to split a long string into smaler chunks (an array), as a separator 
> using every third \n (and not just every \n).
> I could use 'explode', but then it would produce too many chunks.

php.net/preg_split

Cheers,

David
-- 
David Grant
http://www.grant.org.uk/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] ? Split string into smaller chunks

2005-12-19 Thread Anas Mughal
Split them using explode and then combine the ones you need to combined.
Hope this helps.
--
Anas Mughal



On 12/19/05, Labunski <[EMAIL PROTECTED]> wrote:
>
> I need to split a long string into smaler chunks (an array), as a
> separator
> using every third \n (and not just every \n).
> I could use 'explode', but then it would produce too many chunks.
>
> Thank you in advance!
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


--
Anas Mughal


RE: [PHP] ? Split string into smaller chunks

2005-12-19 Thread Jay Blanchard
[snip]
I need to split a long string into smaler chunks (an array), as a separator 
using every third \n (and not just every \n).
I could use 'explode', but then it would produce too many chunks.
[/snip]

http://us2.php.net/manual/en/function.chunk-split.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] ? Split string into smaller chunks

2005-12-19 Thread Labunski
I need to split a long string into smaler chunks (an array), as a separator 
using every third \n (and not just every \n).
I could use 'explode', but then it would produce too many chunks.

Thank you in advance!

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] split string

2001-05-11 Thread Jason Stechschulte

On Fri, May 11, 2001 at 10:24:02AM -0500, Jacky wrote:

> I got series of string value like this 1,2,3. And the seires are
> dynamic dynamaic, which means it is not always 1,2,3 but could be
> more, but always in this format that is separated by "," .  How do I
> pick each of value in the series and assign it into new vairiable,
> like from:
> $test = 1,2,3;
> and assign to be
> $test =1;
> $test1=2;
> $test2 =3;
> Is theer any function that could help me with that? because I need to
> update table using those value but I cannot use series of value to
> update, have to break them down to each variable like that.

Use arrays. 
$test = "1,2,3";
$test = explode(",", $test);
// $test[0] == "1";
// $test[1] == "2";
// $test[2] == "3";
-- 
Jason Stechschulte
[EMAIL PROTECTED]
--
Well, that's more-or-less what I was saying, though obviously addition
is a little more cosmic than the bitwise operators.
 -- Larry Wall in <[EMAIL PROTECTED]>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] split string

2001-05-11 Thread Taylor, Stewart

$test = "1,2,3";
$arrTest = explode(",",$test);
foreach($arrTest as $k=>$v)
{
   $vname = "test".(!$k?"":$k);

   // global for use later
   global $$vname;

   $GLOBALS[$vname] = $v;
}

// now global $test, $test1, $test2 exist etc


-Original Message-
From: Jacky [mailto:[EMAIL PROTECTED]]
Sent: 11 May 2001 16:24
To: [EMAIL PROTECTED]
Subject: [PHP] split string


I got series of string value like this 1,2,3. And the seires are dynamaic,
which means it is not always 1,2,3 but could be more, but always in this
format that is separated by "," .
How do I pick each of value in the series and assign it into new vairiable,
like from:
$test = 1,2,3;
and assign to be
$test =1;
$test1=2;
$test2 =3;
Is theer any function that could help me with that? because I need to update
table using those value but I cannot use series of value to update, have to
break them down to each variable like that.
Jack
[EMAIL PROTECTED]
"There is nothing more rewarding than reaching the goal you set for
yourself"

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] split string

2001-05-10 Thread Jack Dempsey

http://www.php.net/manual/en/function.explode.php

explode on the comma...

you could use while loop and variable variables to take care of the
naming...

-jack

Jacky wrote:
> 
> I got series of string value like this 1,2,3. And the seires are dynamaic, which 
>means it is not always 1,2,3 but could be more, but always in this format that is 
>separated by "," .
> How do I pick each of value in the series and assign it into new vairiable, like 
>from:
> $test = 1,2,3;
> and assign to be
> $test =1;
> $test1=2;
> $test2 =3;
> Is theer any function that could help me with that? because I need to update table 
>using those value but I cannot use series of value to update, have to break them down 
>to each variable like that.
> Jack
> [EMAIL PROTECTED]
> "There is nothing more rewarding than reaching the goal you set for yourself"

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] split string

2001-05-10 Thread Jacky

I got series of string value like this 1,2,3. And the seires are dynamaic, which means 
it is not always 1,2,3 but could be more, but always in this format that is separated 
by "," .
How do I pick each of value in the series and assign it into new vairiable, like from:
$test = 1,2,3;
and assign to be
$test =1;
$test1=2;
$test2 =3;
Is theer any function that could help me with that? because I need to update table 
using those value but I cannot use series of value to update, have to break them down 
to each variable like that.
Jack
[EMAIL PROTECTED]
"There is nothing more rewarding than reaching the goal you set for yourself"



Re: [PHP] split string value again

2001-03-29 Thread Steve Werby

"Jacky" <[EMAIL PROTECTED]> wrote:
> I have a vairable that stores email address value. I need to break it so
> that I will only get the dmain name bit to store in another variable so
> that
> I can redirect user to that domain, like if user email is [EMAIL PROTECTED]
> then I would like to break that and take only foo.com bit to use for
> navigation.

I don't think any of the responses you got took into account email addresses
like [EMAIL PROTECTED]  If you truely just want domain.tld it's a little
more complex.  I happened to have written a script a few months ago that
does what you want.  Even if you don't need something this complex in your
case, my code uses 5 or 6 string functions and arrays so it's a pretty good
example of how to manipulate strings in PHP.



--
Steve Werby
President
Befriend Internet Services LLC
Tel: 804-355-WEBS
http://www.befriend.com/


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] split string value again

2001-03-29 Thread [EMAIL PROTECTED]

thank you everone, sorry about the rush though. I was kind of in urgent
need. Anyway, thanks again.:-)
Jack
[EMAIL PROTECTED]
"There is nothing more rewarding than reaching the goal you set for
yourself"
- Original Message -
From: Stewart Taylor <[EMAIL PROTECTED]>
To: 'Jacky' <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Thursday, March 29, 2001 3:51 AM
Subject: RE: [PHP] split string value again


> $addr = "mailto:[EMAIL PROTECTED];
>
> $splitaddr = explode("@",$addr);
>
> resulting in  $splitaddr[0] = "test";
>   $splitaddr[1] = "foo.com";
>
>
> -Stewart
>
> -Original Message-
> From: Jacky [mailto:[EMAIL PROTECTED]]
> Sent: 29 March 2001 23:52
> To: [EMAIL PROTECTED]
> Subject: [PHP] split string value again
>
>
> Hi again
> have to try again after I have not recieved any advice, I have a vairable
> that stores email address value. I need to break it so that I will only
get
> the dmain name bit to store in another variable so that I can redirect
user
> to that domain, like if user email is [EMAIL PROTECTED] then I would like to
> break that and take only foo.com bit to use for navigation.
> How can I do that?
> Jack
> [EMAIL PROTECTED]
> "There is nothing more rewarding than reaching the goal you set for
> yourself"
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] split string value again

2001-03-29 Thread elias

try this snippet:



""Jacky"" <[EMAIL PROTECTED]> wrote in message
009301c0b8a2$e856f6c0$[EMAIL PROTECTED]">news:009301c0b8a2$e856f6c0$[EMAIL PROTECTED]...
Hi again
have to try again after I have not recieved any advice, I have a vairable
that stores email address value. I need to break it so that I will only get
the dmain name bit to store in another variable so that I can redirect user
to that domain, like if user email is [EMAIL PROTECTED] then I would like to
break that and take only foo.com bit to use for navigation.
How can I do that?
Jack
[EMAIL PROTECTED]
"There is nothing more rewarding than reaching the goal you set for
yourself"




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] split string value again

2001-03-29 Thread Stewart Taylor

$addr = "[EMAIL PROTECTED]";

$splitaddr = explode("@",$addr);

resulting in  $splitaddr[0] = "test";
  $splitaddr[1] = "foo.com";


-Stewart

-Original Message-
From: Jacky [mailto:[EMAIL PROTECTED]]
Sent: 29 March 2001 23:52
To: [EMAIL PROTECTED]
Subject: [PHP] split string value again


Hi again
have to try again after I have not recieved any advice, I have a vairable
that stores email address value. I need to break it so that I will only get
the dmain name bit to store in another variable so that I can redirect user
to that domain, like if user email is [EMAIL PROTECTED] then I would like to
break that and take only foo.com bit to use for navigation.
How can I do that?
Jack
[EMAIL PROTECTED]
"There is nothing more rewarding than reaching the goal you set for
yourself"

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] split string value again

2001-03-29 Thread dempsejn

"try again" after 20 minutes...give people some time to 
respond!...anyways, you can explode the variable...

list($junk,$domain) = explode("@",$email);

checkout http://www.php.net/explode 
you'll use it a lot

-jack

- Original Message -
From: "Jacky" <[EMAIL PROTECTED]>
Date: Thursday, March 29, 2001 5:52 pm
Subject: [PHP] split string value again

> Hi again
> have to try again after I have not recieved any advice, I have a 
> vairable that stores email address value. I need to break it so 
> that I will only get the dmain name bit to store in another 
> variable so that I can redirect user to that domain, like if user 
> email is [EMAIL PROTECTED] then I would like to break that and take 
> only foo.com bit to use for navigation.
> How can I do that?
> Jack
> [EMAIL PROTECTED]
> "There is nothing more rewarding than reaching the goal you set 
> for yourself"
> 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] split string value again

2001-03-29 Thread Martin Cabrera Diaubalick

Try to use explode and keep the second element of the array

Just a quick thought ..

- Original Message -
From: Jacky <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, March 30, 2001 12:52 AM
Subject: [PHP] split string value again


Hi again
have to try again after I have not recieved any advice, I have a vairable
that stores email address value. I need to break it so that I will only get
the dmain name bit to store in another variable so that I can redirect user
to that domain, like if user email is [EMAIL PROTECTED] then I would like to
break that and take only foo.com bit to use for navigation.
How can I do that?
Jack
[EMAIL PROTECTED]
"There is nothing more rewarding than reaching the goal you set for
yourself"



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] split string value

2001-03-29 Thread Yasuo Ohgaki

Use split('@',$email_address)
http://www.php.net/manual/en/function.split.php

--
Yasuo Ohgaki


""Jacky"" <[EMAIL PROTECTED]> wrote in message
005a01c0b8a0$453ede00$[EMAIL PROTECTED]">news:005a01c0b8a0$453ede00$[EMAIL PROTECTED]...
Hi people
If I have value like [EMAIL PROTECTED] stored in a variable. How do I break it up to
be take only the foo.com bit to use that to redirect user back to that URL?
Jack
[EMAIL PROTECTED]
"There is nothing more rewarding than reaching the goal you set for yourself"



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] split string value again

2001-03-29 Thread Jacky

Hi again
have to try again after I have not recieved any advice, I have a vairable that stores 
email address value. I need to break it so that I will only get the dmain name bit to 
store in another variable so that I can redirect user to that domain, like if user 
email is [EMAIL PROTECTED] then I would like to break that and take only foo.com bit to 
use for navigation.
How can I do that?
Jack
[EMAIL PROTECTED]
"There is nothing more rewarding than reaching the goal you set for yourself"



[PHP] split string value

2001-03-29 Thread Jacky

Hi people
If I have value like [EMAIL PROTECTED] stored in a variable. How do I break it up to be 
take only the foo.com bit to use that to redirect user back to that URL?
Jack
[EMAIL PROTECTED]
"There is nothing more rewarding than reaching the goal you set for yourself"