By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,278 Members | 1,329 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,278 IT Pros & Developers. It's quick & easy.

Re: shortcut for isset()?

P: n/a
Thomas Locke wrote:
Thomas Locke wrote:
....>
And here's the link I meant to post:

http://dk.php.net/manual/en/book.filter.php
Thanks! That will be fun to read.

--
Fui et vidi experiri.
=DSM=
Aug 25 '08 #1
Share this Question
Share on Google+
3 Replies


P: n/a
This is my "shortcut"...

a = (isset(a{0}) ? a : b;

My *very* unscientific testes show that this is somewhat faster
than...

a = (isset(a) ? a : b;

It just looks for the first character, or first elements of an array
opposed to the entire variable.

Walter

Aug 26 '08 #2

P: n/a
On 26 Aug, 06:48, phpWalter <otrWal...@torres.wswrote:
This is my "shortcut"...

* a = (isset(a{0}) ? a : b;

My *very* unscientific testes show that this is somewhat faster
than...

* a = (isset(a) ? a : b;

It just looks for the first character, or first elements of an array
opposed to the entire variable.

Walter
I'm not surpised it's faster since

a = (isset(a) ? a : b;

won't work!

Aug 26 '08 #3

P: n/a
..oO(phpWalter)
>This is my "shortcut"...

a = (isset(a{0}) ? a : b;
This is no PHP. And what are the curly braces doing there?
>My *very* unscientific testes show that this is somewhat faster
than...

a = (isset(a) ? a : b;

It just looks for the first character, or first elements of an array
opposed to the entire variable.
I really doubt that there's a difference in performance, at least not
one that matters at all.

Micha
Aug 26 '08 #4

This discussion thread is closed

Replies have been disabled for this discussion.