473,473 Members | 1,415 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

still not working: why?

hi guys, i'm just at the beginning. I apologize. the file still gives
me back an error:

<<Parse error: syntax error, unexpected T_VARIABLE, expecting
T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in d:\tryphp.php on line
19>>

why? Can someone fix it so i can "study" the working one?

class somma
{
var $uno=10;
var $due=15;
var $tre=15;
function sum($uno,
$due, $tre)
{

$totale = $uno + $due + $tre;

return($totale);
}
function sum_2()
{
$totale = $this->sum($this->uno, $this-
>due, $this->tre);
return $totale;
print("$totale");
}
$somma=new_somma();
$sum=$somma->(34,40);
print("$sum");
}

May 29 '07 #1
6 1703
vinnie wrote:
hi guys, i'm just at the beginning. I apologize. the file still gives
me back an error:

<<Parse error: syntax error, unexpected T_VARIABLE, expecting
T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in d:\tryphp.php on line
19>>

why? Can someone fix it so i can "study" the working one?

class somma
{
var $uno=10;
var $due=15;
var $tre=15;
function sum($uno,
$due, $tre)
{

$totale = $uno + $due + $tre;

return($totale);
}
function sum_2()
{
$totale = $this->sum($this->uno, $this-
>due, $this->tre);
return $totale;
print("$totale");
}
$somma=new_somma();
$sum=$somma->(34,40);
print("$sum");
}
You didn't tell what function to call.

When you create an object, you create something with both properties and
methods. You interact with the properties through the methods.

In this case you're not really using any of the properties of the class
($uno, $due, $tre). Rather, you're just trying to call a function with
some parameters.

OOP is a very different way of thinking, but (IMHO) a much superior way
of programming.

For instance, in your class, you might want functions to set
$somma->uno, $somma->dup and $somma->tre, then have a function which
would add the three. While not particularly useful in this instance, it
would be a more accurate example of OOP.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
May 29 '07 #2
On May 28, 10:05 pm, Jerry Stuckle <jstuck...@attglobal.netwrote:
vinnie wrote:
hi guys, i'm just at the beginning. I apologize. the file still gives
me back an error:
<<Parse error: syntax error, unexpected T_VARIABLE, expecting
T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in d:\tryphp.php on line
19>>
why? Can someone fix it so i can "study" the working one?
class somma
{
var $uno=10;
var $due=15;
var $tre=15;
function sum($uno,
$due, $tre)
{
$totale = $uno + $due + $tre;
return($totale);
}
function sum_2()
{
$totale = $this->sum($this->uno, $this-
due, $this->tre);
return $totale;
print("$totale");
}
$somma=new_somma();
$sum=$somma->(34,40);
print("$sum");
}

You didn't tell what function to call.

When you create an object, you create something with both properties and
methods. You interact with the properties through the methods.

In this case you're not really using any of the properties of the class
($uno, $due, $tre). Rather, you're just trying to call a function with
some parameters.

OOP is a very different way of thinking, but (IMHO) a much superior way
of programming.

For instance, in your class, you might want functions to set
$somma->uno, $somma->dup and $somma->tre, then have a function which
would add the three. While not particularly useful in this instance, it
would be a more accurate example of OOP.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attglobal.net
==================
so, writing back the whole algorithm, how should it be?
thanks

May 29 '07 #3
At Mon, 28 May 2007 16:56:34 -0700, vinnie let h(is|er) monkeys type:
hi guys, i'm just at the beginning. I apologize. the file still gives
me back an error:

<<Parse error: syntax error, unexpected T_VARIABLE, expecting
T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in d:\tryphp.php on line
19>>

why? Can someone fix it so i can "study" the working one?

class somma
{
var $uno=10;
var $due=15;
var $tre=15;
function sum($uno,
$due, $tre)
{

$totale = $uno + $due + $tre;

return($totale);
}
function sum_2()
{
$totale = $this->sum($this->uno, $this-
>>due, $this->tre);
return $totale;
print("$totale");
}
$somma=new_somma();
$sum=$somma->(34,40);
print("$sum");
}
Vinnie, are you sure this isn't homework (again!) ? Your first msg clearly
stated:
please help me, i have a test!
I cannot help but think you hardly have a clue about PHP's syntax and
semantics. If you read the replies carefully the answer is already there,
but it seems you just want us to deliver the working code for you.

Sorry, no can do.
--
Schraalhans Keukenmeester - sc*********@the.spamtrapexample.nl
[Remove the lowercase part of Spamtrap to send me a message]

"strcmp('apples','oranges') is -1"

May 29 '07 #4
vinnie wrote:
hi guys, i'm just at the beginning. I apologize. the file still gives
me back an error:

<<Parse error: syntax error, unexpected T_VARIABLE, expecting
T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in d:\tryphp.php on line
19>>

why? Can someone fix it so i can "study" the working one?

class somma
{
var $uno=10;
var $due=15;
var $tre=15;
function sum($uno,
$due, $tre)
{

$totale = $uno + $due + $tre;

return($totale);
}
function sum_2()
{
$totale = $this->sum($this->uno, $this-
>>due, $this->tre);
return $totale;
print("$totale");
Hi Vinnie,

Why do you first return something, and then print something on the next
line?
What do you think will happen?
Will the print-statement ever be reached?

Regards,
Erwin Moller
}
$somma=new_somma();
$sum=$somma->(34,40);
print("$sum");
}
May 29 '07 #5
On May 29, 3:54 am, Erwin Moller
<since_humans_read_this_I_am_spammed_too_m...@spam yourself.comwrote:
vinnie wrote:
hi guys, i'm just at the beginning. I apologize. the file still gives
me back an error:
<<Parse error: syntax error, unexpected T_VARIABLE, expecting
T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in d:\tryphp.php on line
19>>
why? Can someone fix it so i can "study" the working one?
class somma
{
var $uno=10;
var $due=15;
var $tre=15;
function sum($uno,
$due, $tre)
{
$totale = $uno + $due + $tre;
return($totale);
}
function sum_2()
{
$totale = $this->sum($this->uno, $this-
>due, $this->tre);
return $totale;
print("$totale");

Hi Vinnie,

Why do you first return something, and then print something on the next
line?
What do you think will happen?
Will the print-statement ever be reached?

Regards,
Erwin Moller
}
$somma=new_somma();
$sum=$somma->(34,40);
print("$sum");
}
but also if i try to echo $sum, i get nothing, so there must be a
mistake somewhere, and using the 2 books i have it's hard to find
(PHP5 for dummies, and core PHP programming).

May 29 '07 #6
vinnie wrote:
On May 29, 3:54 am, Erwin Moller
<since_humans_read_this_I_am_spammed_too_m...@spam yourself.comwrote:
>vinnie wrote:
>>hi guys, i'm just at the beginning. I apologize. the file still gives
me back an error:
<<Parse error: syntax error, unexpected T_VARIABLE, expecting
T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in d:\tryphp.php on line
19>>
why? Can someone fix it so i can "study" the working one?
class somma
{
var $uno=10;
var $due=15;
var $tre=15;
function sum($uno,
$due, $tre)
{
$totale = $uno + $due + $tre;
return($totale);
}
function sum_2()
{
$totale = $this->sum($this->uno, $this-
due, $this->tre);
return $totale;
print("$totale");
Hi Vinnie,

Why do you first return something, and then print something on the next
line?
What do you think will happen?
Will the print-statement ever be reached?

Regards,
Erwin Moller
>> }
$somma=new_somma();
$sum=$somma->(34,40);
print("$sum");
}

but also if i try to echo $sum, i get nothing, so there must be a
mistake somewhere, and using the 2 books i have it's hard to find
(PHP5 for dummies, and core PHP programming).
First of all, turn on all errors in your php.ini file and display them:

error_reporting = E_ALL
display_errors = On

So you can see your errors. That should help you a little bit.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
May 29 '07 #7

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

Similar topics

4
by: NeverLift | last post by:
I've searched around and don't find the following incident discussed specifically. First, a comment from an experience programmer new to JavaScript: While I am new to javascript, I've...
28
by: Andreas Prilop | last post by:
Jukka reports on http://www.cs.tut.fi/~jkorpela/chars/spaces.html that Internet Explorer 6 fails on the "zero width space" U+200B ​ Is this observation still valid? For which versions of MS...
13
by: Deano | last post by:
Hi, I generate a report using two dates (From and To). I notice if I enter 01/10/2003 that it is interpreted by Access as 10/01/2003 i.e 10th January rather than 1st October as I intended. ...
5
by: Bill Stock | last post by:
I'm inherited a database that has a few issues. One of the less severe issues, but the one the users bitch about is the speed across the LAN. So I thought that I could unbind the NUMEROUS subforms...
687
by: cody | last post by:
no this is no trollposting and please don't get it wrong but iam very curious why people still use C instead of other languages especially C++. i heard people say C++ is slower than C but i can't...
8
by: Brad Simon | last post by:
I have written a shopping cart using ASP .NET (VB). It has been running quite successfully on a site for about a year or so. I use the SessionID as the key to hold information on the shopping...
4
by: Joe | last post by:
I'm hosting my web service on a Windows 2003 box which is remotely located. When trying to add a web reference to a C# project I get an error message 'There was an error downloading...
16
by: pamelafluente | last post by:
I am still working with no success on that client/server problem. I need your help. I will submit simplified versions of my problem so we can see clearly what is going on. My model: A client...
0
by: George2 | last post by:
Hello everyone, Sorry that this question is related to another question I posted some time before because I have some new findings and self-analysis. My question is why sometimes from perfmon...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.