Exactly how a variable should be set, well it could be for instance var $age:int;
Where on the php site does it tell you to set it like that ?
I've never seent that before ?
It is also because you cannot do it... :) It was an idea on how it could be done, with a little inspiration from pascal.
But you could also do both things at the same time, for instance that
you PHP5 can make class type hints about the parameters to a method,
but you can also not do it.
I dont get it do you have an example ?
Well the changes document for PHP5 explains it pretty good:
In PHP5 this: |<?php function foo(ClassName $object) { // ... } ?> |
is equivalent to in PHP4:
| <?php function foo($object) { if (!($object instanceof ClassName)) { die("Argument 1 must be an instance of ClassName"); } } ?> |
Meaning that if you hint the class type of a parameter of your method, and you set the parameter with a different type when you call the parameter, it will produce an error.
You can read more about it here:
http://www.php.net/zend-engine-2.php
/Martin