ID: 11565
Updated by: derick
Reported By: [EMAIL PROTECTED]
Old-Status: Open
Status: Duplicate
Bug Type: Scripting Engine problem
Operating system: 
PHP Version: 4.0.4pl1
Assigned To: 
Comments:

For both your requests are already feature requests filed.
So I'm marking this one as duplicate. However, I was to lazy to look up the bug id's, 
and that's why I didn't add them here.

Derick

Previous Comments:
---------------------------------------------------------------------------

[2001-06-19 13:22:46] [EMAIL PROTECTED]
Hello,


In the following example source:

<?php

class A
{
        var $property = 'string value';

        function methodA()
        {
                echo "$this->propertyn";
        }
}

class B
{
        var $objArray   = array();
        var $currentObj = 0;

        function B()
        {
                $this->objArray[$this->currentObj] = new A;
        }

        function methodB($index = 0)
        {
                return $this->objArray[$index];
        }
}

$b = new B;

/*
 * This works:
 */
$b->objArray[$b->currentObj]->methodA();

/*
 * But this don't:
 */
// $b->methodB()->methodA();

?>

Is it possible to get this work? It is something like collections in JScript of 
Internet Explorer, for example:

<HTML>
<SCRIPT LANGUAGE="JScript">
function numberCells() {
    var count=0;
    for (i=0; i < document.all.mytable.rows.length; i++) {
        for (j=0; j < document.all.mytable.rows(i).cells.length; j++) {

            // Looks like rows() is method of mytable and
            // cells() is method of object returned by rows()
            document.all.mytable.rows(i).cells(j).innerText = count;
            //                   ~~~~~~~ ~~~~~~~~

            count++;
        }
    }
}
</SCRIPT>
<BODY onload="numberCells()">
<TABLE id=mytable border=1>
<TR><TH>&nbsp;</TH><TH>&nbsp;</TH><TH>&nbsp;</TH><TH>&nbsp;</TH></TR>
<TR><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD></TR>
<TR><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD></TR>
</TABLE>
</BODY>
</HTML> 

The following example works in PHP3, but not in PHP4:

<?php

class A
{
        var $var = 'some value';
}

class B
{
        var $date = date('Y.m.d');
        var $a = new A;
}

?>

Is it possible to get it work in PHP4? Maybe, in the future versions of PHP4?

If it's possible let me know about this.


Ramunas

P.s. Sorry for my English.


---------------------------------------------------------------------------



ATTENTION! Do NOT reply to this email!
To reply, use the web interface found at http://bugs.php.net/?id=11565&edit=2


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to