From:             
Operating system: All
PHP version:      5.4.0beta1
Package:          SPL related
Bug Type:         Feature/Change Request
Bug description:Static constructors, or static intializers

Description:
------------
I've noticed a fairly large trend in a lot of php frameworks, as well as in
my 
own code, and I was curious about whether this is planned, the reasons as
to why 
it might not be, or if it has even been brought up.

I've tried to find any other requests about this, but haven't been very 
successful.

Basically, my request is this:
When a class comes into existence (whether the code is in the file you're 
currently in, or you're including it), a static constructor (a common
method for 
it is "::init") is called. This is called only once, the first time the
class 
exists, and would act as a protected method (allowing parent-child objects
to 
call it incase of a class reset?).

This would be pretty awesome, but I don't know if it's practical, or what
all 
your thoughts might have been as I'm sure plenty of you have seen it
floating 
around.

Thanks a bunch for taking the time to read my request, I'm excited to hear
what 
you think :)


-- 
Edit bug report at https://bugs.php.net/bug.php?id=60098&edit=1
-- 
Try a snapshot (PHP 5.4):            
https://bugs.php.net/fix.php?id=60098&r=trysnapshot54
Try a snapshot (PHP 5.3):            
https://bugs.php.net/fix.php?id=60098&r=trysnapshot53
Try a snapshot (trunk):              
https://bugs.php.net/fix.php?id=60098&r=trysnapshottrunk
Fixed in SVN:                        
https://bugs.php.net/fix.php?id=60098&r=fixed
Fixed in SVN and need be documented: 
https://bugs.php.net/fix.php?id=60098&r=needdocs
Fixed in release:                    
https://bugs.php.net/fix.php?id=60098&r=alreadyfixed
Need backtrace:                      
https://bugs.php.net/fix.php?id=60098&r=needtrace
Need Reproduce Script:               
https://bugs.php.net/fix.php?id=60098&r=needscript
Try newer version:                   
https://bugs.php.net/fix.php?id=60098&r=oldversion
Not developer issue:                 
https://bugs.php.net/fix.php?id=60098&r=support
Expected behavior:                   
https://bugs.php.net/fix.php?id=60098&r=notwrong
Not enough info:                     
https://bugs.php.net/fix.php?id=60098&r=notenoughinfo
Submitted twice:                     
https://bugs.php.net/fix.php?id=60098&r=submittedtwice
register_globals:                    
https://bugs.php.net/fix.php?id=60098&r=globals
PHP 4 support discontinued:          
https://bugs.php.net/fix.php?id=60098&r=php4
Daylight Savings:                    https://bugs.php.net/fix.php?id=60098&r=dst
IIS Stability:                       
https://bugs.php.net/fix.php?id=60098&r=isapi
Install GNU Sed:                     
https://bugs.php.net/fix.php?id=60098&r=gnused
Floating point limitations:          
https://bugs.php.net/fix.php?id=60098&r=float
No Zend Extensions:                  
https://bugs.php.net/fix.php?id=60098&r=nozend
MySQL Configuration Error:           
https://bugs.php.net/fix.php?id=60098&r=mysqlcfg

Reply via email to