You are here: Re: MySQL PHP =@ symbol « PHP Programming Language « IT news, forums, messages
Re: MySQL PHP =@ symbol

Posted by Chris Hope on 10/16/60 11:16

Tim Van Wassenhove wrote:

> On 2005-05-17, Chris Hope <blackhole@electrictoolbox.com> wrote:
>> Mike Willbanks wrote:
>>
>>> Chris,
>>>> You could do it like this instead of using the @, although your way
>>>> is less verbose.
>>>>
>>>> $name = isset($_POST['name']) ? $_POST['name'] : '';
>>>>
>>>> An advantage of doing it this way is it this way lets you specify a
>>>> default value.
>>>
>>> sometimes an even better way is with empty, for say if a field is
>>> required data :)
>>>
>>> if (empty($_POST['name'])) {
>>> echo('Name must be filled out.');
>>> }
>>
>> That's cool. Isn't it fun how you can program in a language for 7
>> years and still not know a little thing like that :)
>
> Don't know which one is fastest:
>
> - isset
> - empty
> - array_key_exists

They're all essentially doing the same thing so they probably take about
the same amount of time.

--
Chris Hope | www.electrictoolbox.com | www.linuxcdmall.com

 

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

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