Hello There, Guest! Login Register


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
PHP Hello World
#1
Hello world in php is actually pretty simple. I'll just get right down to it and give you a code snippet -

Code:
<?php
echo 'Hello World';
?>

Now we will go through this line by line. The first line has a less than sign and a question mark symbol followed by php. This tells the web server that we are wanting to run a php script, and not some other script. At the end of the document we close the open php tag so the web server knows we are at the end of the script.

The second line tells the web server to echo or in other words 'show the user some data'. Included in the single quotes is the text that the web server is going to display to the browser.

Lastly we must end every statement with a semicolon. More to come so stay tuned!
Reply
#2
Still haven't started on PHP yet, but I'm sure this will be useful in the future just to get started.
Reply
#3
Really is a good example, since I really don't know the code, I use to copy paste and replac the parts I need, but this is a good example to understand how PHP works
Reply
#4
Very nice one Smile it's simple for beginners at PHP coding or scripting ... yes Hello world is nice word too to welcome members.
Reply
#5
Most of the time I am getting the Hello World as an example/as a starter. Even last time I signed up for the Microsoft Visual Studio for developing Metro apps I got this hello world as an example. Hope hello world, is a welcoming to the programming world, not the "exact" world!
Reply
#6
A "Hello world" is 'always' the beginning program/part if you learn a certain language. I've even seen some tutorials making more advanced "Hello world" programs (for example: explaining "foreach", "while"), I think it's useful for the real beginners so they know what happens if they see "Hello world" instead of random words each tutorial they find.
Reply
#7
That script is my first learn about PHP. First time I tried it look like hard to playing with PHP code, but now it;s absolutely easy and I always using CI framework to build a new projet website.
Reply
#8
There's another way instead of using "echo":
Code:
<?php
print 'Hello World';
?>

Try this Smile
Reply


Forum Jump:


Users browsing this thread:
1 Guest(s)