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" <[EMAIL PROTECTED]>
To: "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
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
> 

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

Reply via email to