From: [EMAIL PROTECTED]
Operating system: UNIX/Windows
PHP version: 4.0.4pl1
PHP Bug Type: Scripting Engine problem
Bug description: classes/objects
Hello,
In the following example source:
<?php
class A
{
var $property = 'string value';
function methodA()
{
echo "$this->property\n";
}
}
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> </TH><TH> </TH><TH> </TH><TH> </TH></TR>
<TR><TD> </TD><TD> </TD><TD> </TD><TD> </TD></TR>
<TR><TD> </TD><TD> </TD><TD> </TD><TD> </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.
--
Edit Bug report at: http://bugs.php.net/?id=11565&edit=1
--
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]