You are here: Re: strval $_REQUEST « PHP Programming Language « IT news, forums, messages
Re: strval $_REQUEST

Posted by Erwin Moller on 05/17/07 08:45

jmark@fastermail.com wrote:

> On May 16, 1:17 pm, Erwin Moller
> <since_humans_read_this_I_am_spammed_too_m...@spamyourself.com> wrote:
>> j...@fastermail.com wrote:
>> > I have seen some code like
>> > $value = strval($REQUEST['value']);
>>
>> > I would like to know what is the use of strval here since $_REQUEST
>> > values are strings?
>>
>> Hi,
>>
>> $_REQUEST values might as well contain arrays.
>>
>> Consider this form:
>> <form action="test.php" Method="POST">
>> <input type="checkbox" name="bla[]" value="1">1<br>
>> <input type="checkbox" name="bla[]" value="2">2<br>
>> <input type="checkbox" name="bla[]" value="3">3<br>
>> </form>
>>
>> When receiving $_POST["bla"] it contains an array.
>>
>> The programmer wanted to make sure it is a string.
>>
>> Regards,
>> Erwin Moller
>>
>> PS: I think you should avoid $_REQUEST. Just use $_POST and $_GET.
>
> But as per documentation
> http://us.php.net/manual/en/function.strval.php
>
> strval can only be used on scalars
> using strval on arrays has no effect.
> the programmer should have used is_string if its a string

good point.
Kind of useless action indeed.

Regards,
Erwin Moller

 

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

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