FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » What happens when i dont use the semicolon for closing my statement
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
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 Go to previous message
richard is currently offline  richard   
Messages: 213
Registered: June 2013
Karma:
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.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Download now
Next Topic: Usage of named entities (HTML) in imagettftext
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Tue Nov 26 05:59:03 GMT 2024

Total time taken to generate the page: 0.03951 seconds