Klassenfunktionen liefern Fehler bei array_map()
am 19.09.2006 10:28:58 von friedrich.loefflerGuten Tag NG,
ich habe ein Array von Daten:
$arr=
Array
(
0 => 'mod_topic_export_favourite'=>1,
1 => 'mod_pp_attachement_file_types'=>'gif;jpeg'
)
Diese möchte mit 2 Funktionen aus der Klasse 'variables' bearbeiten.
class variables {
function delete_normalquotes($string)
{
return str_replace("'",'',$string);
}
function array_split($string)
{
return explode('=>',$string);
}
}
$arr=array_map("$variables->delete_normalquotes",$arr);
$arr=array_map("$variables->array_split",$arr);
Dabei erscheinen folgende Fehlermledungen:
- Notice: Undefined property: variables::$delete_normalquotes in
C:\apachefriends\xampp\htdocs\admin.php on line 329
- Warning: array_map() [function.array-map]: The first argument, '', should
be either NULL or a valid callback in
C:\apachefriends\xampp\htdocs\gethree\community\forum\admin. php on line 329
- Notice: Undefined property: variables::$array_split in
C:\apachefriends\xampp\htdocs\admin.php on line 330
- Warning: array_map() [function.array-map]: The first argument, '', should
be either NULL or a valid callback in
C:\apachefriends\xampp\htdocs\gethree\community\forum\admin. php on line 330
Wo liegt der Fehler? Ich möchte gerne die Klassenfunktionen so belassen wie
sie sind.
Ohne Klasse, also als einfache Funktioinen funktioniert das Schema.
Greets.