[wp-hackers] PHP Coding Practices

Dave Grijalva grijalva at gmail.com
Wed Feb 15 01:40:00 GMT 2006


That's not really true.  I'm pretty sure you can foreach a PHP4 array.  It's
been a while since I coded in 4, but I think it returns the objects
properties.  In either case, it seems foolish to include code that will
become a problem in the future, no matter how remote.  Plus, people who are
running on 5 and want to take advantage of it should be able to.  Backwards
compatibility is great, but forwards compatibility is a no brainer.

On 2/14/06, Mark Jaquith <mark.wordpress at txfx.net> wrote:
>
> On Feb 14, 2006, at 7:46 PM, Andy Skelton wrote:
>
> > Worthwhile to use strpos !== false in all new and updated code (I
> > recently started doing that, too) but I wouldn't sweat the old stuff
> > unless you're really bored.
>
> I am, from time to time (bored, that is).  I've submitted patches
> that purely fix spaces => tabs and fix indentation issues. :-)
>
> >> Issue #2
> >> foreach ( (array) $things as $thing ) {
> >
> > That's awesome except you can also foreach an object. Be careful
> > about that.
>
> You can only foreach() objects in PHP5.  I don't see WordPress
> dropping PHP4 support anytime soon, so I think we're safe there.
>
> --
> Mark Jaquith
> http://txfx.net/
>
>
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>


More information about the wp-hackers mailing list