Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:40534 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 31777 invoked from network); 16 Sep 2008 20:05:25 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 16 Sep 2008 20:05:25 -0000 Authentication-Results: pb1.pair.com header.from=ionut.stan@yahoo.com; sender-id=unknown; domainkeys=good Authentication-Results: pb1.pair.com smtp.mail=ionut.stan@yahoo.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain yahoo.com from 209.191.91.193 cause and error) DomainKey-Status: good X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: ionut.stan@yahoo.com X-Host-Fingerprint: 209.191.91.193 web36401.mail.mud.yahoo.com Received: from [209.191.91.193] ([209.191.91.193:40625] helo=web36416.mail.mud.yahoo.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id B1/FE-30574-48110D84 for ; Tue, 16 Sep 2008 16:05:25 -0400 Received: (qmail 73514 invoked by uid 60001); 16 Sep 2008 20:05:22 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=X-YMail-OSG:Received:X-Mailer:Date:From:Subject:To:MIME-Version:Content-Type:Message-ID; b=sqqotwpOq4WyuxnYaB/sy259a9Jv9jK8d15DsxaMmzUFQ7edDR7eNPb9N1l5odIhdjQTHoRQ+jbhmVSMnY20MZ15XAv6PzQCDYdFnAa6wTqlMhKu7RvXV8sfPYLHdrhcsckLG3Sj3i8cBtjypRrLDLuW1k55eDYVaNbkEqE5ap4=; X-YMail-OSG: 08fo5g0VM1lpKIU2EnnsmfJ4SKgCu7lREmTrtMoFCFdlKy3335LLGnUNkfv14Vaw7q2ZIM.G0vBemJpnUE3pQmkY9hsW1AkFVC4B19SOD3xADTR6Xto_QyF2SjafjeC9v58- Received: from [86.106.195.153] by web36401.mail.mud.yahoo.com via HTTP; Tue, 16 Sep 2008 13:05:22 PDT X-Mailer: YahooMailRC/1096.28 YahooMailWebService/0.7.218.2 Date: Tue, 16 Sep 2008 13:05:22 -0700 (PDT) To: internals@lists.php.net MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Message-ID: <46322.71759.qm@web36401.mail.mud.yahoo.com> Subject: Namespaced function vs static method in global class From: ionut.stan@yahoo.com (Ionut Gabriel Stan) Hi, I've decided to play a little with namespaces as some of you asked for feedback on this list or on your blogs. I'm just an userland developer and have no clue about PHP internals so forgive me if I say something stupid in this regard. Here's what I found on some simple test. It may be the intended behaviour but confused me so I decided to ask on this list for clarifications. I have two files: ------------------------------------------------------------------------ 1. include.php '; echo ::Test::foo(); // outputs namespace function echo '
'; echo call_user_func(array('Test', 'foo')); // outputs static method echo '
'; echo Bar::baz(); // outputs namespaced static method echo '
'; echo call_user_func(array('Bar', 'baz')); // gives warning I have executed them on a very recent snapshot of 5.3.0alpha3-dev on a Windows XP. The result is put on comments by the appropriate lines. My questions are: 1. How should I call the static method foo in the global class Test (except for call_user_func) 2. How should I call the static method baz of class Bar in namespace Test with call_user_func 3. Is there no possibility to change your minds and replace the double colon with something else, likes a simple colon? I find it very confusing to figure out what is what and the way I should call it. Thank you in advance, I. Stan