You are here: Re: Splitting strings, explode? « All PHP « IT news, forums, messages
Re: Splitting strings, explode?

Posted by Stefan Rybacki on 08/27/05 13:09

mike wrote:
> "Stefan Rybacki" <stefan.rybacki@gmx.net> wrote in message
> news:3n9cgnFggb6U1@individual.net...
>
>>mike wrote:
>>
>>>I have variables values in the format of names such as this
>
>
>>Use explode as you already said.
>>
>>$names=explode(",",str_replace("&",",",$search));
>>
>>run thru this array ($names) with foreach
>>
>>foreach($names as $name) {
>>$name=trim($name);
>>
>>//do your search
>>}
>
>
> thanks for your reply, but I can't get it to work
>
> printing $name simply displays "Array"?
>
>
Well then you did something wrong while copy and paste. Try this code snippet


$search = "Lisa, Marie, Jenny & Kevin";

$names=explode(",",str_replace("&",",",$search));

foreach($names as $name) {
$name=trim($name);

print($name."\n<br>");
}


Stefan

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация