Date: 05/16/00
- Next message: Ulf Wendel: "Re: [phplib-dev] Question about broken OOP stuff"
- Previous message: Ulf Wendel: "Re: [phplib-dev] Question about broken OOP stuff"
- In reply to: James McCann: "[phplib-dev] Question about broken OOP stuff"
- Next in thread: Ulf Wendel: "Re: [phplib-dev] Question about broken OOP stuff"
- Reply: Ulf Wendel: "Re: [phplib-dev] Question about broken OOP stuff"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Try this: (use PHP 4.0 RCX/Beta 4)
<?
class Base
{
var $x , $array;
function Base () { $this -> x = "my data"; }
function get_next () { return new Base2; }
}
class Base2
{
function display () { print "Display() called\n"; }
}
$obj[0] = new Base;
$x = $obj [0] -> get_next ();
$x -> display ();
$obj[0]->array[0] = "cool";
print "{$obj[0]->x} = {$obj[0]->array[0]}";
?>
$x = $obj [0] -> get_next () -> display ();
Should work! But it doesn't. If the parser parses each
token invidually (and correctly) then it should understand
the class reference sent by get_next (). Zeev, any info?
Faisal
----- Original Message -----
From: "James McCann" <james <email protected>>
To: <phplib-dev <email protected>>
Cc: <ericpe <email protected>>
Sent: Tuesday, May 16, 2000 9:38 PM
Subject: [phplib-dev] Question about broken OOP stuff
| Hello, I am using PHP at work and have run into several
| difficulties using the OO features of PHP. I ended up
| having to use a number of irritating workarounds that
| will make the code harder to maintain.
|
| Specifically:
| $obj[0]->get_next()->display();
| Doesn't work
|
| Also variable interpolation doesn't seem to work right:
| # OK
| print $obj[0]->string . "<br>\n";
| # OK
| printf("%s<br>\n", $obj[0]->string);
| # Broken
| printf("$obj[0]->string<br>\n");
|
| Also:
| # Broken
| $obj[0]->iarray[0] = 13;
| $obj[0]->display();
|
| Other than the problems w/ object referencing I find that
| PHP fits the bill for our project quite nicely, & I would
| like to continue to use it, but I don't think it will be
| possible to use it if OO stuff is broken. Do you have any
| idea when these might be addressed?
|
| Thanks,
| James
---------------------------------------------------------------------
To unsubscribe, e-mail: phplib-dev-unsubscribe <email protected>
For additional commands, e-mail: phplib-dev-help <email protected>
- Next message: Ulf Wendel: "Re: [phplib-dev] Question about broken OOP stuff"
- Previous message: Ulf Wendel: "Re: [phplib-dev] Question about broken OOP stuff"
- In reply to: James McCann: "[phplib-dev] Question about broken OOP stuff"
- Next in thread: Ulf Wendel: "Re: [phplib-dev] Question about broken OOP stuff"
- Reply: Ulf Wendel: "Re: [phplib-dev] Question about broken OOP stuff"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

