Re: [PHP] Functions with Static Variables vs. Classes

2007-11-29 Thread Jochem Maas
[EMAIL PROTECTED] wrote: > From: "Zoltán Németh" <[EMAIL PROTECTED]> >>> function example($elem='') { >>> static $store = array(); >> AFAIK the above line should cause an error on the second run of the >> function, as you declare the same static variable for the second time. >> >> or am I wro

Re: [PHP] Functions with Static Variables vs. Classes

2007-11-29 Thread news_yodpeirs
From: "Zoltán Németh" <[EMAIL PROTECTED]> >> function example($elem='') { >> static $store = array(); > > AFAIK the above line should cause an error on the second run of the > function, as you declare the same static variable for the second time. > > or am I wrong? I think so - otherwise sta

Re: [PHP] Functions with Static Variables vs. Classes

2007-11-29 Thread Zoltán Németh
2007. 11. 29, csütörtök keltezéssel 14.18-kor [EMAIL PROTECTED] ezt írta: > For some simple applications I use a function to collect values in a static > variable and to return them when called in a special way, just like this > (fairly senseless) example: > function example($elem='') { > sta

[PHP] Functions with Static Variables vs. Classes

2007-11-29 Thread news_yodpeirs
For some simple applications I use a function to collect values in a static variable and to return them when called in a special way, just like this (fairly senseless) example: function example($elem='') { static $store = array(); if (!func_num_args()) return($store); ... do something