Why does my php code work on some websites but not others.

Joined
Jan 6, 2023
Messages
4
Reaction score
0
I am learning php and I have noticed this a lot.

I am reading through tutorials online then i got to try out that code on my localhost and it doesn't work. Even by using copying and pasting the code it doesn't work.

It gives me errors on my localhost. I can go on a different website and copy and paste it and depending on the website sometimes it will work.

This code for example. It works on w3schools but won't work on my localhost using xampp


It is because of the php version the website is using?



code
w3schools.PNG



result
w3schoolsResult.PNG








code
xampp.PNG





result
resultXampp.PNG
 
Last edited:

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,828
Messages
2,569,736
Members
45,518
Latest member
vlonesshirt

Latest Threads

Top