You are here: Re: replacing null values and line breaks in file « All PHP « IT news, forums, messages
Re: replacing null values and line breaks in file

Posted by windandwaves on 11/23/06 00:32

windandwaves wrote:
> Hi Gurus
>
> I want to replace null values with a space and line breaks with a |
> symbol in a file. I have written the following function:
>
> function replace_characters($path, $file) {
> $str = file_get_contents($path.$file);
> $str = str_replace("\r\n", "jjjjjjjjjjjjjj", $str);
> file_put_contents($path.$file);
> }
>
> How do I replace the null value
>
> TIA
>
> Nicolaas

This is what I did:

$nullcharacter= chr(0);
$str = str_replace($nullcharacter, "", $str);

OR

$str = str_replace("\0", "", $str);

HTH

Nicolaas

 

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

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