Alternatively you may again use a regex statement
[Aside]
Is it just me? Or does nobody know how to use or of the existence of
Regular
Expressions??
Why does nobody suggest them???
I find them not only a God send, but more of a primitive form of God[or
Allah/Buddah/<insert deity here>]'s very first most useful creation ever.
I
find water less important than that of Regular Expressions..
Ok so I have exaggerated as usual, but do you get my point??
blah!
[/Aside]
$str = "this_word";
$clean_str = preg_replace("/.*_([\w]+)$/i","$1",$str);
That would work as well...
Plus the advantage is that you don't return with an array, not that
arrays
are all that bad, my first child will be named Arrarius..
Ok.. more bullcrap..
haha, nevertheless, depending on the situation, you may WANT to have an
array returned in which will simply be exploding, or spliting the
elements
of the string seperated by the "_" underscore character in an array..
If you are simply wanting to strip any word before and including the
underscore character and return with a "clean" string, then my method is
great for that.
I just seem to have read your question and obviously intepreted it
differently than the others??
Let me know what you prefer.
---oOo--- Allowing users to execute CGI scripts in any directory should
only
be considered if: ... a.. You have no users, and nobody ever visits your
server. ... Extracted Quote: Security Tips - Apache HTTP
Server ---oOo--- ------oOo---------------oOo------ Julien Bonastre
[The_RadiX] The-Spectrum Network CEO ABN: 64 235 749 494
julien@xxxxxxxxxxxxxxxx
www.the-spectrum.org ------oOo---------------oOo------
----- Original Message -----
From: "Ron Piggott (PHP)" <ron.php@xxxxxxxxxxxxxxxxxx>
To: <amol@xxxxxxxxxx>; "PHP DB" <php-db@xxxxxxxxxxxxx>
Sent: Friday, December 09, 2005 2:13 PM
Subject: Re: Manipulating text
> Thanks for telling me the 'explode' command. Ron
>
> On Fri, 2005-12-09 at 08:07 +0530, Amol Hatwar wrote:
>> On Thu, 2005-12-08 at 21:25 -0500, Ron Piggott (PHP) wrote:
>> > If I have
>> >
>> > $variable = "play_time";
>> >
>> > how may I remove "play_" from $variable and just have $variable
>> > equal
>> > to
>> > "time"?
>> >
>>
>> If you are hinting at '_' as a delimitter, you can use explode().
>> Learn
>> more about it here:
>> http://php.net/explode
>>
>> Regards,
>>
>> ah
>>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>