473,382 Members | 1,736 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

T_OBJECT_OPERATOR error

<?
class foo {

var $value;
var $child = array();

function setChild($ch) {
array_push($this->child,$ch);
}

function getChild($i) {
return $this->child[$i];
}

function getValue() {
return $this->value;
}

}

$tp = new foo();
$row = new foo();

$row->setChild($tp);

$row->getChild(0)->getValue();

?>

When I run this script i get the error

Parse error: parse error, unexpected T_OBJECT_OPERATOR in \\path\to\file on line 26

on line "$row->getChild(0)->getValue();"

can someone help me out here..??

Thanx

Salil

--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Salil Das | It's ok to kiss a fool,
bugs@cc | It's ok to let a fool kiss you,
| but never ever let a kiss fool you.
Jul 17 '05 #1
4 11112
On Sat, 17 Apr 2004 22:05:55 +0000, bugs wrote:
<?
class foo {

var $value;
var $child = array();

function setChild($ch) {
array_push($this->child,$ch);
}

function getChild($i) {
return $this->child[$i];
}

function getValue() {
return $this->value;
}

}

$tp = new foo();
$row = new foo();

$row->setChild($tp);

$row->getChild(0)->getValue();

?>

When I run this script i get the error

Parse error: parse error, unexpected T_OBJECT_OPERATOR in \\path\to\file on line 26

on line "$row->getChild(0)->getValue();"

$a = $row->getChild(0);
$b = $a->getValue();

Regards,
Henk Burgstra
Jul 17 '05 #2
"bugs" <bu**@cc.gatech.edu> wrote in message
news:c5**********@solaria.cc.gatech.edu...
<?
class foo {

var $value;
var $child = array();

function setChild($ch) {
array_push($this->child,$ch);
}

function getChild($i) {
return $this->child[$i];
}

function getValue() {
return $this->value;
}

}

$tp = new foo();
$row = new foo();

$row->setChild($tp);

$row->getChild(0)->getValue();

?>


If you plan to program in this way, you're in for a world of hurt. Your
program probably won't behave the way you think it would, because all your
assignments are by copy and you're always returning copies of the child
objects.
Jul 17 '05 #3
Henk Burgstra <eg****@xs4all.nl> wrote:
On Sat, 17 Apr 2004 22:05:55 +0000, bugs wrote:

<?
class foo {

$a = $row->getChild(0);
$b = $a->getValue();

Ya, I came up with that, but, isnt there a way to do this like C style..
would be helpful rather than creating a new variable everytime..

--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Salil Das | It's ok to kiss a fool,
bugs@cc | It's ok to let a fool kiss you,
| but never ever let a kiss fool you.
Jul 17 '05 #4
Salil Das schrieb:
Henk Burgstra <eg****@xs4all.nl> wrote:
On Sat, 17 Apr 2004 22:05:55 +0000, bugs wrote:

<?
class foo {

$a = $row->getChild(0);
$b = $a->getValue();

Ya, I came up with that, but, isnt there a way to do this like C style..


Use PHP 5.

Regards,
Matthias
Jul 17 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: sky2070 | last post by:
Parse error: parse error, unexpected T_OBJECT_OPERATOR, expecting ')' in c:\inetpub\wwwroot\session.php on line 19 can anyone tell me what is wrong with this code??? <? // Define the Session...
2
by: AIM | last post by:
Error in msvc in building inheritance.obj to build hello.pyd Hello, I am trying to build the boost 1.31.0 sample extension hello.cpp. I can not compile the file inheritance.cpp because the two...
5
by: Tony Wright | last post by:
Hi, I am having a problem installing an msi for a web site. The error message I am getting is: "The specified path 'http://mipdev05/features/Fas2' is unavailable. The Internet Information...
13
by: deko | last post by:
I use this convention frequently: Exit_Here: Exit Sub HandleErr: Select Case Err.Number Case 3163 Resume Next Case 3376 Resume Next
7
by: p | last post by:
WE had a Crystal 8 WebApp using vs 2002 which we upgraded to VS2003. I also have Crystal 9 pro on my development machine. The web app runs fine on my dev machine but am having problems deploying....
5
by: devereaux | last post by:
I'm trying to run a script and it's throwing the following error: Parse error: syntax error, unexpected T_OBJECT_OPERATOR in openfile.php on line 41 Here is the openfile.php file and I have...
1
by: mohsin shekh | last post by:
Hello dear members, I am displaying the online news through rss feed in my portal, it is working good enough on localhost WAMP but when i upload the script on our USA...
2
hyperpau
by: hyperpau | last post by:
Before anything else, I am not a very technical expert when it comes to VBA coding. I learned most of what I know by the excellent Access/VBA forum from bytes.com (formerly thescripts.com). Ergo, I...
0
hyperpau
by: hyperpau | last post by:
Before anything else, I am not a very technical expert when it comes to VBA coding. I learned most of what I know by the excellent Access/VBA forum from bytes.com (formerly thescripts.com). Ergo, I...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.