Monthly Archives: January 2009
In accounting, why do ‘debit’ & ‘credit’ change meaning in different contexts
I spent some time wrapping my head around this the other day. Basically in accounting the meanings of credit & debit change. For an asset account, for example, a credit DE-creases it’s value while a debit IN-creases it’s value. However … Continue reading
Setting dynamic arguments / paramaters in constructor ( ala call_user_func_array for objects ) via reflection
So PHP has a reflective API which is neat, you can do: $command = ‘setValue’; $myObj->$command(); but what happens if you need to also set a variable number of variables with your method. For this PHP introducescall_user_func_array. For the first … Continue reading
Setting up helper paths in Zend Framework bootstraps
The Zend documentation is a bit sparse around this topic, it mentions setting up helper paths in the bootstrap, but does not go into detail. The Zend API documentation provides no clear cut answer either. For those of you who … Continue reading
SPL Object iteration in PHP5
The easy way. class myClass implements IteratorAggregate { $this->array = array( ‘one’, ‘two’, ‘three’ ); public function getIterator() { return $this->array; } } $myClass = new myClass(); foreach( $myClass as $property ) { echo $property; }
Major Magento bug with toString arguments php 5.3
Magento will not run on PHP 5.3. Theres a magic method __toString() classes can implement in PHP, its not supposed to have arguments. Magento uses arguments. In PHP 5.3 they add error handling and it triggers a fatal error. Mageno requires a minimum of PHP 5.2 to run. That means if you freeze your code base you’re not going to be able to upgrade, past 5.2 Continue reading