Re: in Operator
| From: | Dennis Birkholz | Date: | Tue, 20 Jan 2015 15:54:42 +0000 |
| Subject: | Re: in Operator | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-80881@lists.php.net to get a copy of this message | ||
Am 20.01.2015 um 16:42 schrieb Rowan Collins:
> Given the ability to write foreach ( $foo as $key => $value ), I'm not
> sure adding a variant syntax of for ( $key in $foo ) has that much value
> for PHP.
I totally agree with you here.
The only real reason why Javascript has a for-in operation that iterates
over object properties is the lack of non-integer keys in Javascript arrays.
For PHP iterating over object properties is a very rare case IMHO. So I
would stick with foreach for that case.
Kind regards,
Dennis Birkholz