PHP 4.0 Bug #4674: limitations of array_walk() calling methods or single-parameter functions

From: Date: Mon, 29 May 2000 16:13:00 +0000
Subject: PHP 4.0 Bug #4674: limitations of array_walk() calling methods or single-parameter functions
Groups: php.dev 
Request: Send a blank email to php-dev+get-19697@lists.php.net to get a copy of this message
From: waldschrott@kiffen.de Operating system: All PHP version: 4.0.0 Release PHP Bug Type: Feature/Change Request Bug description: limitations of array_walk() calling methods or single-parameter functions array_walk() is limited in the way a) it cannot call methods in classes and b) it´s not possible to call functions which expect one parameter like htmlspecialchars(); the prior fixing of (a) would enable the user to write a wrapper functions in classes to be able to use single-parameter functions though Test script: <?php $obj=new RX_mail(1); class RX_mail { var $examples=array(1=>array('foo@foo.com','"foo"@subfoo.foo.com', '*@foo.com'), 2=>array('"foobiee" <foo@foo.com>','<subfoo@sub.foo.com>')); function RX_mail($type) { $this->array=$this->examples[$type]; // Before returning $this->examples[$type] I wanted to array_walk // all items to be able to display them // 1) does not work array_walk($this->array,'htmlspecialchars'); // 2 does not work, as said array_walk($this->array,'this->wrapper'); } function wrapper(&$param1,$param2='') { return htmlspecialchars($param1); }} ?>

« previous php.dev (#19697) next »