Re: beginner: remove the string after the first whitespace

From: Date: Thu, 28 Aug 2003 04:45:22 +0000
Subject: Re: beginner: remove the string after the first whitespace
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-161003@lists.php.net to get a copy of this message
This code is working for me <?php $old="Dinesh Dinesh Dinesh Dinesh"; $new=""; for($i=0;$old[$i]!='';$i++) { $new=$new.$old[$i]; if($old[$i]==' ') break; } echo $new; ?> -murugesan ----- Original Message ----- From: "Andras Kende" <andras@kende.com> To: "Php-General@Lists.Php.Net" <php-general@lists.php.net> Sent: Thursday, August 28, 2003 10:03 AM Subject: [PHP] beginner: remove the string after the first whitespace > > Hello All, > > I have a very simple question: > > Want to remove the string after the first whitespace like: > > "here is a text what i have" > to: > "here" > > > Thanks !! > > Andras Kende > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

« previous php.general (#161003) next »