You are here: Re: addcslashes « PHP Programming Language « IT news, forums, messages
Re: addcslashes

Posted by Kimmo Laine on 02/08/07 07:26

"Taras_96" <taras.di@gmail.com> wrote in message
news:1170918221.814144.39540@s48g2000cws.googlegroups.com...
> Hi everyone,
>
>>From what I understand in of addcslashes, addcslashes should add a
> backslash before every character listed in the character list. I've
> done a couple of experiments:
>
> echo bin2hex(addcslashes("a","a")) gives 5c31, as expected ('\'
> followed by 'a')

Ascii lowercase 'a' is 0x61, not 0x31. 0x31 is '1'. 0x5c is indeed a
backslash. I got 61 when I tried the line above.

> Next, I tried
>
> echo bin2hex(addcslashes("\0","\0")); which gave 5c 30 30 30, which is
> a backslash followed by 3 spaces.

0x30 is ascii '0' (zero), not a space (which is 0x20).

> What's happening here?

Something quite odd. Since \0 is the string terminating character, it would
seem that it throws the functions a bit off. File a bug report?

 

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

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