473,320 Members | 2,112 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,320 software developers and data experts.

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 1699
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
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.