Re: patch files for PEAR
| From: | Bertrand Mansion | Date: | Thu, 28 Aug 2003 07:25:24 +0000 |
| Subject: | Re: patch files for PEAR | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-20719@lists.php.net to get a copy of this message | ||
<cox@idecnet.com> wrote :
>
>
> On Thursday, August 28, 2003 2:35, Alan Knowles wrote:
>
>> generally yes.. - but I've yet to find a better way to do
>
>> $val = (isset($_POST['x']) && !is_null($_POST['x'])) ?
>> $_POST['x'] : null;
>
>> $val = @$_POST['x'];
>
> What about empty()? ;)
If $_POST['x'] equals '0', then this fails.
You have to use if (isset($_POST['x']) && $_POST['x'] != '')
if you expect a
scalar.
But remember that PHP autoconverts some posted vars to arrays. For example,
<input name="myArray[x]"> is converted automatically to
$_POST['myArray'][]..
Bertrand Mansion
Mamasam