Re: [PHP] substr trim functions..

2001-12-14 Thread Nicolas Costes


$pos=strpso($line, );
$last=substr($line, $pos, strlen($line));

http://www.php.net/manual/en/function.substr.php
http://www.php.net/manual/en/function.strpos.php
http://www.php.net/manual/en/function.strlen.php

@+++

Le Vendredi 14 Décembre 2001 17:11, Andras Kende a écrit :
 I trying to convert some full names to last names only like:
 -get the subtext from the end until the space

 joe blue - blue
 bill western - western

 Looked around at php.net docs but im not sure...

 Thanks

 Andras

-- 
 ( * Nicolas Costes,
 //\\  IUT de La Roche / Yon
( \/ ) [EMAIL PROTECTED]
http://luxregina.free.fr

--
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] substr trim functions..

2001-12-14 Thread jimtronic


There are no shortage of ways to do this.

// Using explode() ...

echo array_pop(explode( ,$full_name));

// Using split() ...

echo array_pop(split( ,$full_name));

// Using stristr() 

while($haystack = stristr($haystack, )) {
$haystack = substr($haystack,1);
$last_word = $haystack;
}
echo $last_word;

Plus all the preg_match and regular expression functions...

http://php.net/explode
http://php.net/split
http://php.net/stristr

jim

I trying to convert some full names to last names only like:
-get the subtext from the end until the space

joe blue - blue
bill western - western

Looked around at php.net docs but im not sure...

Thanks

Andras




--
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]


-- 
Jim Musil
-
Multimedia Programmer
Nettmedia
-
212-629-0004
[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]