You are here: Re: Complete newbie looking for a little help « PHP Programming Language « IT news, forums, messages
Re: Complete newbie looking for a little help

Posted by Toby A Inkster on 05/10/07 12:50

Iván Sánchez Ortega wrote:

> Or even with the more compact ternary-operator form:
> $search = isset($_GET['search']) ? $_GET['search'] : NULL ;

This is quite a common thing to do, so I recommend creating a function for
it:

function ifsetor ($a, $b)
{
if (isset($a)) return $a;
return $b;
}

$search = ifsetor($_GET['search'], NULL);

I keep meaning to write a function that does the same for N arguments
instead of 2.

--
Toby A Inkster BSc (Hons) ARCS
http://tobyinkster.co.uk/
Geek of ~ HTML/SQL/Perl/PHP/Python/Apache/Linux

 

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

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