You are here: Re: REGEX help please « PHP Programming Language « IT news, forums, messages
Re: REGEX help please

Posted by Zilla on 09/29/05 16:09

Defaultman wrote:
> 1) change a string of:
> number\number\number to number/number/number

You don't have to use regexp to do this. Try this:

$var = str_replace('\\', '/', $var);

assuming $var contains the string you want to change.

> 2) change a string of:
> numbers to digit/digit/digit

This you can du with chunk_split():

$var = chunk_split($var, 1, '/');

This puts a '/' between every character in $var AND in the end. So if
you don't want the '/' in the end you can remove it with substr():

$var = substr($var, 0, -1);

Hope this is useful.

Zilla.

 

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

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