Re: PHP Array Literals
| From: | James Crane | Date: | Sun, 29 Jan 2006 20:21:20 +0000 |
| Subject: | Re: PHP Array Literals | ||
| References: | 1 2 3 4 5 6 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-21720@lists.php.net to get a copy of this message | ||
Then why don't we have these:
$i = integer(5);
$f = float(4.5);
$s = string("foo");
And what about classes? It's slightly different, what with it being a
definition rather than a specific literal value, but it produces a
definition, pseudo value if you will, so why not have:
class("MyClass", array("method", array("arguments"), "method body
here"));
Of course, that woudln't make sense. We, instead, use appropriate syntax:
class MyClass {
public function method($arguments) {
// method body here
}
}
Suitable, logical, appropriate code. To me, 'array()' just seems on
the verge of being (but not totally) inappropriate.
M.T.