1

I'll be quick.

I'm creating a simple website that generates a set of random characters, but I'm having a little trouble with the php code.

From what I can see, Notepad++ is automatically turning my angle brackets into comments.

I have too low of a reputation to post all my pictures, so here's a link to an imgur album: https://i.stack.imgur.com/fTOv6.jpg

First you have my code, then a full page and a close up of it running in Chrome, then a full page and a close up of it running in FireFox.

As you can see, something is changing my

<?php echo 'egfwe'; ?>

line, to

<!--?php echo 'egfwe'; ?-->

which comments out my php brackets, making it useless.

Thanks for your time.

4
  • Why do you think it's Notepad++ that is doing this and changing your code to comment it out? I'm not sure where Notepad++ comes into the loop with your PHP site code and I assume you're talking about production code right on your server/site and not when you manipulate it with the Notepad++ app. Please clarify a little further if you could. Jul 6, 2016 at 21:51
  • I thought that it was an error, and since it was the same on both firefox and google, it would have to be notepad++. Also, I haven't hosted this or anything, I'm just running it straight from notepad++. Jul 6, 2016 at 22:00
  • Do you use some Notepad++ plugin to run it with or just to manipulate the logic? I guess I'm confused how Notepad++ is any different with manipulating text of a text file unless you tell it to do something, etc. unless you're using a plugin perhaps? Jul 6, 2016 at 22:02
  • Save the file then open it with notepad.exe (without '++') just to check the dashes are there or not.
    – Putnik
    Jul 7, 2016 at 15:32

1 Answer 1

1

NP++ isn't to blame.

Try directly replacing the page's html using Chrome's console:

document.open();
document.write("<?php echo 'egfwe'; ?>") 
document.close()

It turns into a comment, without even being touched by NP++, because those tags aren't valid HTML. This is because to run PHP code, you need an actual server to execute the code (since PHP is a server-side script). Simply loading it from your filesystem won't work.

Take a look here: https://stackoverflow.com/questions/3004696/is-there-a-simple-php-development-server

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .