pain

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Not sure why I'm sharing this; but it could be a gotcha

<?php

class testBase {

	public function __call( $methodName , $values )
	{
		echo __METHOD__ . PHP_EOL;
		print_r( $values );
	}

}

class testOuter {

	private $base;
	
	public function __construct()
	{
		$this->base = new testBase;
	}
	public function __call( $methodName , $values )
	{
		echo __METHOD__ . PHP_EOL;
		print_r( $values );
		$this->base->test( $values );
	}

}

$test = new testOuter;
$test->test( 'test' );

?>

output:
testOuter::__call
Array
(
    [0] => test
)
testBase::__call
Array
(
    [0] => Array
        (
            [0] => test
        )

)

point:
note the $values keep getting nested into an array one deeper; get's frustrating when dealing with passing arrays and detecting whats in them! [consider if( count($values) ) or even foreach etc..]!

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux