Jump to content

Recommended Posts

Hello

i said to replace the short php tags (<??>) with long php tags (<?php ?>)

but it is giving me Parse errors -.-

 

the parse error apears if i have

<?php//NOTE ?>

 

With <?//NOTE?> Is all ok and it dosnt give me that error ..

could anyone please tell me why dos it give the error and some more details about the tags etc

 

Thanks in advance

Link to comment
https://forums.phpfreaks.com/topic/210514-php-tags/
Share on other sites

None of -

 

<?php//NOTE?>

 

or

 

<?php//NOTE ?>

 

or

 

<?php //NOTE ?>

 

produce a parse error (edit: on a system with short_open_tags turned off, I did not test on a system with them on.)

 

You likely have some other syntax error prior to that point that is being detected when the <?php tag is being encountered.

 

Please post the actual error and the code up to the point where the error is being reported.

 

edit: on a system with short_open_tags turned ON, you do get runtime notices for the <?php//NOTE?> and <?php//NOTE ?> versions about php being an undefined constant, but those are not parse errors.

Link to comment
https://forums.phpfreaks.com/topic/210514-php-tags/#findComment-1098380
Share on other sites

@ Pikachu2000

i know that works but i was wondering why <?php//MESAGE?> Isnt working without the space

 

@PFMaBiSmAd

 

It dos produce the error ........ otherwise i wouldnt post if i wasnt sure it produced the error

Well i have short tags enabled

 

And it did gaved a parse error :P

 

 

here are the exact errors and code ...

<?php//Login
error_reporting(0);
//$KEY  = 'blablaaahhhhhhhhhhhhhhhhhhhhhhhh';
$KEY  = 'BLAAAAHHHHHHHHHHHHHHHHHHHHHHHh';//Localhost

 

With <?php//Login it gives the error bellow

Parse error: parse error in C:\wamp\www\IP\index.php on line 2

 

if i remove line 2 it gives a same error at line 4

 

they arent serious errors but i said that it'll be safer with the full php tags in my script

Link to comment
https://forums.phpfreaks.com/topic/210514-php-tags/#findComment-1098385
Share on other sites

With short_open_tags ON, the php code you have written cannot be parsed.

 

With short_open_tags OFF, the php code you have written can be parsed.

 

Short-answer: Don't put a comment immediately following a php tag without any white-space between the tag and the comment.

Link to comment
https://forums.phpfreaks.com/topic/210514-php-tags/#findComment-1098388
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.