[PHP] Basics of PHP Scripting

jeeter

New Member
Messages
9
Reaction score
0
Points
0
Basics of PHP

Here you will find a tutorial that is about the very basics of developing in PHP. This tutorial will continue to grow as I add more to it and is a beginning step for newbie PHP Developers or for those looking for a refresher.

**NOTE: PLEASE DO NOT REPLY TO THIS POST. IT WILL MESS UP THE INDEXING! ALL REPLIES MADE WILL BE REQUESTED TO BE DELETED**


Getting Started:
If you have never developed a web site or a web page before, at all, I would suggest reading up on some tutorials about developing using HTML first. Once you've become accustomed to HTML's language, then you should come back and begin your journey into PHP here. This tutorial is going to give advice as to how to do certain actions using PHP.

1.) PHP Basic Syntax:
PHP has special opening and closing tags for its code blocks, very much like HTML's
opening and closing tags (<html></html>). These are mandatory to be wrapped around any PHP code that you submit.

Example: Opening and Closing of a code block in PHP
PHP:
<?php
  
?>
*Note: A PHP file normally contains HTML tags, just like an HTML file, and some PHP scripting code.*


Below, we have an example of a simple PHP script which sends the all too well known text "Hello World" to the browser:
PHP:
<html>
<body> 

   <?php
      echo "Hello World";
     ?> 

</body>
</html>
*NOTE:Each code line in PHP must end with a semicolon. The semicolon is a separator and is used to distinguish one set of instructions from another.*

*NOTE:There are two basic statements to output text with PHP: echo and print. In the example above we have used the echo statement to output the text "Hello World".*

*NOTE:
The file must have the .php extension. If the file has a .html extension, the PHP code will not be executed.*
 
Last edited:

akosiameer

New Member
Messages
11
Reaction score
0
Points
0
I think you have to include how to install and where to get PHPfor the script to work.
 

taha116

Member
Messages
505
Reaction score
0
Points
16
You can improve the tutorial by providing more relevant youtube videos and links that people may find usefull in the footer of the topic post.
 

adamparkzer

On Extended Leave
Messages
3,745
Reaction score
81
Points
0
**NOTE: PLEASE DO NOT REPLY TO THIS POST. IT WILL MESS UP THE INDEXING! ALL REPLIES MADE WILL BE REQUESTED TO BE DELETED**


Awesome, guys. Way to READ the entire post, including special requests.

And yes, I realize that I posted too. But oh seeing as a handful of people already posted, I'm sure my one response won't be that bad.
 

allofus

New Member
Messages
183
Reaction score
2
Points
0
[/left]

Awesome, guys. Way to READ the entire post, including special requests.

And yes, I realize that I posted too. But oh seeing as a handful of people already posted, I'm sure my one response won't be that bad.

<?php echo "I won't reply then"; ?>
 

Steeevoe

New Member
Messages
103
Reaction score
0
Points
0
When using PHP, does the use of all of these pairs of symbols mean the same thing?

1) `.....`
2) "....."
3) '.....'

If not please tell me when and why they should be used!
 

rowenalee

New Member
Messages
3
Reaction score
0
Points
0
I am new to PHP Scripting and Taha is right it would be better if you have provided a video tutorial so I could easily understand the basics of PHP scripting. Let me know if you did that. Thanks!
 

archdesun

New Member
Messages
29
Reaction score
0
Points
0
Basics of PHP

Here you will find a tutorial that is about the very basics of developing in PHP. This tutorial will continue to grow as I add more to it and is a beginning step for newbie PHP Developers or for those looking for a refresher.

**NOTE: PLEASE DO NOT REPLY TO THIS POST. IT WILL MESS UP THE INDEXING! ALL REPLIES MADE WILL BE REQUESTED TO BE DELETED**


Getting Started:
If you have never developed a web site or a web page before, at all, I would suggest reading up on some tutorials about developing using HTML first. Once you've become accustomed to HTML's language, then you should come back and begin your journey into PHP here. This tutorial is going to give advice as to how to do certain actions using PHP.

1.) PHP Basic Syntax:
PHP has special opening and closing tags for its code blocks, very much like HTML's
opening and closing tags (<html></html>). These are mandatory to be wrapped around any PHP code that you submit.

Example: Opening and Closing of a code block in PHP
PHP:
<?php
  
?>
*Note: A PHP file normally contains HTML tags, just like an HTML file, and some PHP scripting code.*


Below, we have an example of a simple PHP script which sends the all too well known text "Hello World" to the browser:
PHP:
<html>
<body> 

   <?php
      echo "Hello World";
     ?> 

</body>
</html>
*NOTE:Each code line in PHP must end with a semicolon. The semicolon is a separator and is used to distinguish one set of instructions from another.*

*NOTE:There are two basic statements to output text with PHP: echo and print. In the example above we have used the echo statement to output the text "Hello World".*

*NOTE:
The file must have the .php extension. If the file has a .html extension, the PHP code will not be executed.*
Very good tutorial.Thanks. hihi
 

dev-ware

New Member
Messages
5
Reaction score
0
Points
0
Steeevoe, the first one cannot be used to show text. echo is faster than print, single quotes are faster than double.
 

misson

Community Paragon
Community Support
Messages
2,572
Reaction score
72
Points
48
When using PHP, does the use of all of these pairs of symbols mean the same thing?

1) `.....`
2) "....."
3) '.....'
Read the PHP manual on the string type.

echo is faster than print
Any support for this comment? That echo doesn't require concatenating strings doesn't count, since your statement is more general, though you could qualify your statement.

@archdesun: are you serious? Why?
 

vishal

-::-X10 Guru-::-
Community Support
Messages
5,255
Reaction score
192
Points
63
Very good tutorial, improve it with advanced
 
Top