Page 2 of 2
Posted: Tue Dec 05, 2006 5:48 am
by volka
And I guess now we know the reason for
ole wrote:If they can make it so it triggers an error when you use clone on a array then they could have it return the array with cloned objects. I personally feel its a hole in the functionality of the language.
The developers of php simply saw no need for cloning arrays

Posted: Tue Dec 05, 2006 6:05 am
by Chris Corbyn
ole wrote:Code: Select all
/**
* Recursively iterates over an array cloning any objects encountered
*
* @param array $toClone
* @return array
*/
static public function arrayRecursiveClone(array $toClone)
{
Psst... you have "static" in the wrong place
EDIT |
Manual wrote:The static declaration must be after the visibility declaration. For compatibility with PHP 4, if no visibility declaration is used, then the member or method will be treated as if it was declared as public.
Posted: Tue Dec 05, 2006 7:15 am
by Ollie Saunders
d11wtq wrote:Psst... you have "static" in the wrong place
EDIT |
Manual wrote:The static declaration must be after the visibility declaration. For compatibility with PHP 4, if no visibility declaration is used, then the member or method will be treated as if it was declared as public.
PHP 4, PHP snore. I don't care about that.

Posted: Tue Dec 05, 2006 7:50 am
by Chris Corbyn
It's two separate sentences. You should still have static second. It's the same in Java.
Posted: Tue Dec 05, 2006 8:19 am
by Ollie Saunders
Oh right then its quite possible neither php 4 or 5 cares given
this example.