|
Re: What happens when i dont use the semicolon for closing my statement [message #177878 is a reply to message #177874] |
Wed, 25 April 2012 09:20 |
Erwin Moller
Messages: 228 Registered: September 2010
Karma: 0
|
Senior Member |
|
|
On 4/25/2012 10:43 AM, hakimserwa(at)gmail(dot)com wrote:
> I am new to php and i am trying to learn so i would appreciate if i can cleary understand how the php syntax work by knowing how to do it and what happens if i dont do something.
>
> In this case i would like to know what happens i i dont close my statement with a semicolon.
Why don't you try?
Test1:
<?php
$name = "hakim";
echo $name;
?>
Test2:
<?php
$name = "hakim"
echo $name
?>
And test them.
Also, make sure you have error reporting on when learning the language,
or developing.
Regards,
Erwin Moller
--
"That which can be asserted without evidence, can be dismissed without
evidence."
-- Christopher Hitchens
|
|
|
Re: What happens when i dont use the semicolon for closing my statement [message #177879 is a reply to message #177878] |
Wed, 25 April 2012 10:05 |
hakimserwa
Messages: 2 Registered: April 2012
Karma: 0
|
Junior Member |
|
|
On Wednesday, April 25, 2012 11:20:55 AM UTC+2, Erwin Moller wrote:
> On 4/25/2012 10:43 AM, hakimserwa(at)gmail(dot)com wrote:
>> I am new to php and i am trying to learn so i would appreciate if i can cleary understand how the php syntax work by knowing how to do it and what happens if i dont do something.
>>
>> In this case i would like to know what happens i i dont close my statement with a semicolon.
>
> Why don't you try?
>
> Test1:
> <?php
> $name = "hakim";
> echo $name;
> ?>
>
> Test2:
> <?php
> $name = "hakim"
> echo $name
> ?>
>
> And test them.
>
> Also, make sure you have error reporting on when learning the language,
> or developing.
>
> Regards,
> Erwin Moller
>
> --
> "That which can be asserted without evidence, can be dismissed without
> evidence."
> -- Christopher Hitchens
Parse error: syntax error, unexpected '}', expecting ',' or ';' in C:\xampp\htdocs\hello.php on line 13
how do i read this error and undcerstan what it means so next time in can be able to solve it so quickly.
|
|
|
Re: What happens when i dont use the semicolon for closing my statement [message #177880 is a reply to message #177879] |
Wed, 25 April 2012 10:45 |
Erwin Moller
Messages: 228 Registered: September 2010
Karma: 0
|
Senior Member |
|
|
On 4/25/2012 12:05 PM, hakimserwa(at)gmail(dot)com wrote:
<snip>
> Parse error: syntax error, unexpected '}', expecting ',' or ';' in C:\xampp\htdocs\hello.php on line 13
>
> how do i read this error and undcerstan what it means so next time in can be able to solve it so quickly.
Hello,
Please post your code in your file hello.php, so we can see what is wrong.
Regards,
Erwin Moller
--
"That which can be asserted without evidence, can be dismissed without
evidence."
-- Christopher Hitchens
|
|
|
Re: What happens when i dont use the semicolon for closing my statement [message #177881 is a reply to message #177879] |
Wed, 25 April 2012 11:04 |
Captain Paralytic
Messages: 204 Registered: September 2010
Karma: 0
|
Senior Member |
|
|
On Apr 25, 11:05 am, hakimse...@gmail.com wrote:
> On Wednesday, April 25, 2012 11:20:55 AM UTC+2, Erwin Moller wrote:
>> On 4/25/2012 10:43 AM, hakimse...@gmail.com wrote:
>>> I am new to php and i am trying to learn so i would appreciate if i can cleary understand how the php syntax work by knowing how to do it and what happens if i dont do something.
>
>>> In this case i would like to know what happens i i dont close my statement with a semicolon.
>
>> Why don't you try?
>
>> Test1:
>> <?php
>> $name = "hakim";
>> echo $name;
>> ?>
>
>> Test2:
>> <?php
>> $name = "hakim"
>> echo $name
>> ?>
>
>> And test them.
>
>> Also, make sure you have error reporting on when learning the language,
>> or developing.
>
>> Regards,
>> Erwin Moller
>
>> --
>> "That which can be asserted without evidence, can be dismissed without
>> evidence."
>> -- Christopher Hitchens
>
> Parse error: syntax error, unexpected '}', expecting ',' or ';' in C:\xampp\htdocs\hello.php on line 13
>
> how do i read this error and undcerstan what it means so next time in can be able to solve it so quickly.
It may be that programming just isn't for you. You left out a
semicolon and the message said "expecting ',' or ';'". You read this
error from left to right and you will see that it says that the
character that you left out is not there. I cannot see why you can't
understand this, but as I say, if you really can't see that then maybe
programming isn't for you.
|
|
|
Re: What happens when i dont use the semicolon for closing my statement [message #177890 is a reply to message #177879] |
Wed, 25 April 2012 13:33 |
Redcat
Messages: 3 Registered: February 2012
Karma: 0
|
Junior Member |
|
|
On Wed, 25 Apr 2012 03:05:01 -0700, hakimserwa wrote:
> Parse error: syntax error, unexpected '}', expecting ',' or ';' in
> C:\xampp\htdocs\hello.php on line 13
>
> how do i read this error and undcerstan what it means so next time in
> can be able to solve it so quickly.
In this case take a look at line 13 (though with PHP error reporting -
with any language's error reporting, actually - the error might not
actually be on the line mentioned in the report). If you intentionally
left off the semicolon as was suggested in a previous post, to see what
would happen, then the error message is saying "Hey, you left something
off!". The parser was expecting to see a ',' or a ';' but it found a '}'
instead.
If this error message doesn't seem to jibe with what you expect, then
post the entire php file so we can look at it and we'll figure out what
the error was.
Redcat
|
|
|
Re: What happens when i dont use the semicolon for closing my statement [message #177893 is a reply to message #177890] |
Wed, 25 April 2012 14:55 |
The Natural Philosoph
Messages: 993 Registered: September 2010
Karma: 0
|
Senior Member |
|
|
Redcat wrote:
> On Wed, 25 Apr 2012 03:05:01 -0700, hakimserwa wrote:
>
>> Parse error: syntax error, unexpected '}', expecting ',' or ';' in
>> C:\xampp\htdocs\hello.php on line 13
>>
>> how do i read this error and undcerstan what it means so next time in
>> can be able to solve it so quickly.
>
> In this case take a look at line 13 (though with PHP error reporting -
> with any language's error reporting, actually - the error might not
> actually be on the line mentioned in the report). If you intentionally
> left off the semicolon as was suggested in a previous post, to see what
> would happen, then the error message is saying "Hey, you left something
> off!". The parser was expecting to see a ',' or a ';' but it found a '}'
> instead.
>
> If this error message doesn't seem to jibe with what you expect, then
> post the entire php file so we can look at it and we'll figure out what
> the error was.
>
Or alternatively, don't program (in PHP) and wait for a language that
can intuitively decide 100% correctly what you really meant from what
you actually said.
> Redcat
--
To people who know nothing, anything is possible.
To people who know too much, it is a sad fact
that they know how little is really possible -
and how hard it is to achieve it.
|
|
|
Re: What happens when i dont use the semicolon for closing my statement [message #177897 is a reply to message #177879] |
Thu, 26 April 2012 01:24 |
|
richard
Messages: 213 Registered: June 2013
Karma: 0
|
Senior Member |
|
|
On Wed, 25 Apr 2012 03:05:01 -0700 (PDT), hakimserwa(at)gmail(dot)com wrote:
> On Wednesday, April 25, 2012 11:20:55 AM UTC+2, Erwin Moller wrote:
>> On 4/25/2012 10:43 AM, hakimserwa(at)gmail(dot)com wrote:
>>> I am new to php and i am trying to learn so i would appreciate if i can cleary understand how the php syntax work by knowing how to do it and what happens if i dont do something.
>>>
>>> In this case i would like to know what happens i i dont close my statement with a semicolon.
>>
>> Why don't you try?
>>
>> Test1:
>> <?php
>> $name = "hakim";
>> echo $name;
>> ?>
>>
>> Test2:
>> <?php
>> $name = "hakim"
>> echo $name
>> ?>
>>
>> And test them.
>>
>> Also, make sure you have error reporting on when learning the language,
>> or developing.
>>
>> Regards,
>> Erwin Moller
>>
>> --
>> "That which can be asserted without evidence, can be dismissed without
>> evidence."
>> -- Christopher Hitchens
>
>
> Parse error: syntax error, unexpected '}', expecting ',' or ';' in C:\xampp\htdocs\hello.php on line 13
>
> how do i read this error and undcerstan what it means so next time in can be able to solve it so quickly.
It says that it was expecting a character to be found in a certain place
and did not find it.
The "}" is the place where the character should be but is not.
If line 13 only contains the "}" then look above that line and within the
"{ }".
Now you know that the character ";" is required.
So use it accordingly.
|
|
|
Re: What happens when i dont use the semicolon for closing my statement [message #177898 is a reply to message #177897] |
Thu, 26 April 2012 02:29 |
Jerry Stuckle
Messages: 2598 Registered: September 2010
Karma: 0
|
Senior Member |
|
|
On 4/25/2012 9:24 PM, richard wrote:
> On Wed, 25 Apr 2012 03:05:01 -0700 (PDT), hakimserwa(at)gmail(dot)com wrote:
>
>> On Wednesday, April 25, 2012 11:20:55 AM UTC+2, Erwin Moller wrote:
>>> On 4/25/2012 10:43 AM, hakimserwa(at)gmail(dot)com wrote:
>>>> I am new to php and i am trying to learn so i would appreciate if i can cleary understand how the php syntax work by knowing how to do it and what happens if i dont do something.
>>>>
>>>> In this case i would like to know what happens i i dont close my statement with a semicolon.
>>>
>>> Why don't you try?
>>>
>>> Test1:
>>> <?php
>>> $name = "hakim";
>>> echo $name;
>>> ?>
>>>
>>> Test2:
>>> <?php
>>> $name = "hakim"
>>> echo $name
>>> ?>
>>>
>>> And test them.
>>>
>>> Also, make sure you have error reporting on when learning the language,
>>> or developing.
>>>
>>> Regards,
>>> Erwin Moller
>>>
>>> --
>>> "That which can be asserted without evidence, can be dismissed without
>>> evidence."
>>> -- Christopher Hitchens
>>
>>
>> Parse error: syntax error, unexpected '}', expecting ',' or ';' in C:\xampp\htdocs\hello.php on line 13
>>
>> how do i read this error and undcerstan what it means so next time in can be able to solve it so quickly.
>
>
> It says that it was expecting a character to be found in a certain place
> and did not find it.
> The "}" is the place where the character should be but is not.
> If line 13 only contains the "}" then look above that line and within the
> "{ }".
> Now you know that the character ";" is required.
> So use it accordingly.
The problem here is the ';' is not required at the end of the line. PHP
detects the error when it gets something it doesn't expect - in this
case it's most probably the next line. However, in some cases (like
unmatched '{', it could be much later - or even the end of the script.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
|
|
|
Re: What happens when i dont use the semicolon for closing my statement [message #177899 is a reply to message #177898] |
Thu, 26 April 2012 02:59 |
|
richard
Messages: 213 Registered: June 2013
Karma: 0
|
Senior Member |
|
|
On Wed, 25 Apr 2012 22:29:31 -0400, Jerry Stuckle wrote:
> On 4/25/2012 9:24 PM, richard wrote:
>> On Wed, 25 Apr 2012 03:05:01 -0700 (PDT), hakimserwa(at)gmail(dot)com wrote:
>>
>>> On Wednesday, April 25, 2012 11:20:55 AM UTC+2, Erwin Moller wrote:
>>>> On 4/25/2012 10:43 AM, hakimserwa(at)gmail(dot)com wrote:
>>>> > I am new to php and i am trying to learn so i would appreciate if i can cleary understand how the php syntax work by knowing how to do it and what happens if i dont do something.
>>>> >
>>>> > In this case i would like to know what happens i i dont close my statement with a semicolon.
>>>>
>>>> Why don't you try?
>>>>
>>>> Test1:
>>>> <?php
>>>> $name = "hakim";
>>>> echo $name;
>>>> ?>
>>>>
>>>> Test2:
>>>> <?php
>>>> $name = "hakim"
>>>> echo $name
>>>> ?>
>>>>
>>>> And test them.
>>>>
>>>> Also, make sure you have error reporting on when learning the language,
>>>> or developing.
>>>>
>>>> Regards,
>>>> Erwin Moller
>>>>
>>>> --
>>>> "That which can be asserted without evidence, can be dismissed without
>>>> evidence."
>>>> -- Christopher Hitchens
>>>
>>>
>>> Parse error: syntax error, unexpected '}', expecting ',' or ';' in C:\xampp\htdocs\hello.php on line 13
>>>
>>> how do i read this error and undcerstan what it means so next time in can be able to solve it so quickly.
>>
>>
>> It says that it was expecting a character to be found in a certain place
>> and did not find it.
>> The "}" is the place where the character should be but is not.
>> If line 13 only contains the "}" then look above that line and within the
>> "{ }".
>> Now you know that the character ";" is required.
>> So use it accordingly.
>
> The problem here is the ';' is not required at the end of the line. PHP
> detects the error when it gets something it doesn't expect - in this
> case it's most probably the next line. However, in some cases (like
> unmatched '{', it could be much later - or even the end of the script.
How very true.
When I do basic progamming I sometinmes wind up with the program telling me
something is incomplete.
Then I have to look around and see why.
e.g.
While a>b
while C<d
wend
gives me an error because the second while did not have a matching wend.
|
|
|