From: "Bob McConnell" on 25 Jun 2010 13:58 From: Daevid Vincent > Why do this "in_array()" business?? > > Just do this... > > if (self::$aboveArray[$name]) > { > //something interesting here > } Does that gibberish actually do something? It doesn't make any sense to me, while in_array() actually looks like what it does. Bob McConnell
From: Peter Lind on 25 Jun 2010 14:55 On 25 June 2010 19:58, Bob McConnell <rvm(a)cbord.com> wrote: > From: Daevid Vincent > >> Why do this "in_array()" business?? >> >> Just do this... >> >> if (self::$aboveArray[$name]) >> { >> Â Â //something interesting here >> } > > Does that gibberish actually do something? It doesn't make any sense to > me, while in_array() actually looks like what it does. > Gibberish?? Probably a good time to go look up some php tutorials. Apart from that, it's rather bad form as a missing index will create a notice at the least. The isset snippet is better, though if you care about finding null values you need to go the route of array_keys(). Regards Peter -- <hype> WWW: http://plphp.dk / http://plind.dk LinkedIn: http://www.linkedin.com/in/plind BeWelcome/Couchsurfing: Fake51 Twitter: http://twitter.com/kafe15 </hype>
From: "Bob McConnell" on 25 Jun 2010 15:07 From: Peter Lind > On 25 June 2010 19:58, Bob McConnell <rvm(a)cbord.com> wrote: >> From: Daevid Vincent >> >>> Why do this "in_array()" business?? >>> >>> Just do this... >>> >>> if (self::$aboveArray[$name]) >>> { >>> //something interesting here >>> } >> >> Does that gibberish actually do something? It doesn't make any sense to >> me, while in_array() actually looks like what it does. >> > > Gibberish?? Probably a good time to go look up some php tutorials. No thanks. I tried to figure out that double colon nonsense over a decade ago as part of an OOP development team. I still don't understand most of the code written during those two years, even though I still maintain parts of it. All I see is a lot of unnecessary overhead with no significant return on the investment. I'll stick with the tried and true procedural notation, at least until I retire next year. Bob McConnell
First
|
Prev
|
Pages: 1 2 Prev: Making a Password Confirmation in PHP Next: Attachment to email from form. |