note 79031 deleted from language.oop5.magic by felipe

[email protected]
Newsgroups php.notes
Message-ID <[email protected]>
Note Submitter: otsu dot ni at gmail dot com 

----

Looks like __toString() method doesn't have to be declared as public (at least for php 5.2.1).
<?php
class A{
    protected function __toString(){
        return "Nya!\n";
    }
}

class O{
    private function __toString(){
        return "Nyo!\n";
    }
}

$nya=new A; $nyo=new O;
echo $nya,$nyo;
?>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.