Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:65078 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 64964 invoked from network); 22 Jan 2013 12:29:52 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 22 Jan 2013 12:29:52 -0000 Authentication-Results: pb1.pair.com header.from=pete@the-echoplex.net; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=pete@the-echoplex.net; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain the-echoplex.net from 208.113.200.5 cause and error) X-PHP-List-Original-Sender: pete@the-echoplex.net X-Host-Fingerprint: 208.113.200.5 caibbdcaaaaf.dreamhost.com Windows 98 (1) Received: from [208.113.200.5] ([208.113.200.5:58993] helo=homiemail-a81.g.dreamhost.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id FD/45-28294-E368EF05 for ; Tue, 22 Jan 2013 07:29:51 -0500 Received: from homiemail-a81.g.dreamhost.com (localhost [127.0.0.1]) by homiemail-a81.g.dreamhost.com (Postfix) with ESMTP id 009CAA8075 for ; Tue, 22 Jan 2013 04:29:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=the-echoplex.net; h= mime-version:date:message-id:subject:from:to:content-type; s= the-echoplex.net; bh=YqJFFgxTJziKAFdfjbFbiV2trUE=; b=PoPVXkw/c3i mrzNw6Mp7cxzukGlvi0JUtW6dr1Fh0ZT3/M2frmVrMNYeEavy5yVHPDYphBRu33B Iwbt4z0s9p/v8bjuKKG3xY5cU/9DGWmTV+Rk8a1uBjXPD0b1aNxsl8iRs/AwAdk7 vjH47+IYiDVqPbDCBwBDYafZhV5FuP+U= Received: from mail-vc0-f178.google.com (mail-vc0-f178.google.com [209.85.220.178]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: pete@the-echoplex.net) by homiemail-a81.g.dreamhost.com (Postfix) with ESMTPSA id B3D40A8072 for ; Tue, 22 Jan 2013 04:29:47 -0800 (PST) Received: by mail-vc0-f178.google.com with SMTP id m8so5790161vcd.37 for ; Tue, 22 Jan 2013 04:29:47 -0800 (PST) MIME-Version: 1.0 X-Received: by 10.220.218.197 with SMTP id hr5mr22789608vcb.8.1358857786966; Tue, 22 Jan 2013 04:29:46 -0800 (PST) Received: by 10.58.34.99 with HTTP; Tue, 22 Jan 2013 04:29:46 -0800 (PST) Date: Tue, 22 Jan 2013 12:29:46 +0000 Message-ID: To: internals@lists.php.net Content-Type: multipart/alternative; boundary=bcaec5396864b1422c04d3dfbbdd Subject: __init magic method From: pete@the-echoplex.net (Pete Boere) --bcaec5396864b1422c04d3dfbbdd Content-Type: text/plain; charset=UTF-8 Has there ever been any discussion on an __init magic method for bootstraping static properties on class load? The usual solution I come up with is manually calling an init method post class definition, which works, though I'd call it slighly less than elegant: class Foo { static $bar; static function init () { // Create $bar with expressions... self::$bar = $bar; } } Foo:init(); A custom autoloader could of course anticipate this but with systems like composer that have a shared autoload, it'd be nicer to use those than rely on a custom loader. -- Pete Boere Web Developer --bcaec5396864b1422c04d3dfbbdd--