Post: BASIC PHP [Level: Beginners]
04-09-2016, 04:19 PM #1
(adsbygoogle = window.adsbygoogle || []).push({});
BASIC PHP [Level: Beginners]


Basic Syntax

Starting a PHP File
    <?php

//Your code could go here

?>



Comments
Comments are section or line of code that will not be executed in the Site

    <?php
//This is just a single line comment
/*
This is a multi line comment
*/
?>


Echo
Echo is a function that is built into php that is used to output text tot he screen you can aloes use it to output html code

    ?php
echo "Hello World";
?>


String Concatenation
String Concatenation is used to bind two string together this is helpful once you learn about variables

    <?php
echo "Hello " . "World";
?>

The output would be
    Hello World


Includes
Includes are used to add a php file inside another one so you can use there functions(we will do functions soon) and there variables

    <?php
include "login.php";
?>


Now that you know the basic Syntax of PHP we will move on to Variables



Variables

Basic Variable
A Basic Variable is used to store some type of value. to start off a variable in php you have to use a $ then after that you put what ever name you would like the Followed with a =
then the variable value
    <?php
$thename = "Hello World";

echo $thename;
?>


Constants
A Constant is a variable that can not be unset or changed once the code has been executed.
To start constant you use the function define()

    <?php
/*the define functions takes 3 parameters: name, value, case insensitive
Example*/
define("NGU", "isOnline");
// Using case insensitive
define("NGU1", "isOnline", true);
//You and aloes define Constants like this
const NGU2 = "isOnline";
?>


This you can store in a variable


  1. Int = A Number
  2. String = A word Example: "Hello World"
  3. Bool = True or False
  4. Float = 1.0
  5. Array = More then one value
  6. NULL = Nothing


This you can store in a variable
Arrays are variable that you can store more then 1 value in this is helpful when when returning data from a database

    <?php
$myarray = array(1 => "Lachie444", 2 => "Jelly");
echo $myarray[1];
?>


Now that you know the basic of variables we will move onto functions





Functions

Functions are helpful so you dont have to have the same code over and over again in your code and to call it in another file when included.

Basic Functions

To start off a function you use (function) followed by the name you would like end it with () Example [ function my_function() ]
    <?php

function my_function()
{
//In here you put code that will executed when the function is called
echo "Hello World";
}

//Calling the function
my_function();

?>


The output would be
    Hello World


Function Parameters

Function Parameters are arguments are passed by the function to the function code with a value
    <?php

//Here's a example $string This is argument for the function my_function
function my_function($string)
{
echo $string;
}

//Calling the function with the argument
my_function("Hello World");
?>


The output would be
    Hello World




This is the end of this tutorial of basic PHP in the future ill make another tutorial going into some more advanced PHP Example: MySql, Classes and more

Thanks for reading this tutorial was made by: Lachie444
Credits:
Kurt: For making want to learn PHP ages ago when he was selling his mod menu for GTA.
Jelly: For being gay asf
Last edited by lachie444 ; 04-09-2016 at 04:24 PM.

The following 9 users say thank you to lachie444 for this useful post:

Boliberrys, Sabotage, Frosty, Jelly, Kam, John, Kronos, Jon Snow
04-09-2016, 04:20 PM #2
Jelly
Maggbot timeout!
first and decent
04-09-2016, 04:26 PM #3
Kronos
Former Staff
Nice! thanks for this Smile

The following user thanked Kronos for this useful post:

04-09-2016, 04:27 PM #4
Sabotage
Gaming Squad
:O u r trouble. Gud Thread tho

The following user thanked Sabotage for this useful post:

04-09-2016, 04:37 PM #5
Originally posted by lachie444 View Post
BASIC PHP [Level: Beginners]


Basic Syntax

Starting a PHP File
    <?php

//Your code could go here

?>



Comments
Comments are section or line of code that will not be executed in the Site

    <?php
//This is just a single line comment
/*
This is a multi line comment
*/
?>


Echo
Echo is a function that is built into php that is used to output text tot he screen you can aloes use it to output html code

    ?php
echo "Hello World";
?>


String Concatenation
String Concatenation is used to bind two string together this is helpful once you learn about variables

    <?php
echo "Hello " . "World";
?>

The output would be
    Hello World


Includes
Includes are used to add a php file inside another one so you can use there functions(we will do functions soon) and there variables

    <?php
include "login.php";
?>


Now that you know the basic Syntax of PHP we will move on to Variables



Variables

Basic Variable
A Basic Variable is used to store some type of value. to start off a variable in php you have to use a $ then after that you put what ever name you would like the Followed with a =
then the variable value
    <?php
$thename = "Hello World";

echo $thename;
?>


Constants
A Constant is a variable that can not be unset or changed once the code has been executed.
To start constant you use the function define()

    <?php
/*the define functions takes 3 parameters: name, value, case insensitive
Example*/
define("NGU", "isOnline");
// Using case insensitive
define("NGU1", "isOnline", true);
//You and aloes define Constants like this
const NGU2 = "isOnline";
?>


This you can store in a variable


  1. Int = A Number
  2. String = A word Example: "Hello World"
  3. Bool = True or False
  4. Float = 1.0
  5. Array = More then one value
  6. NULL = Nothing


This you can store in a variable
Arrays are variable that you can store more then 1 value in this is helpful when when returning data from a database

    <?php
$myarray = array(1 => "Lachie444", 2 => "Jelly");
echo $myarray[1];
?>


Now that you know the basic of variables we will move onto functions





Functions

Functions are helpful so you dont have to have the same code over and over again in your code and to call it in another file when included.

Basic Functions

To start off a function you use (function) followed by the name you would like end it with () Example [ function my_function() ]
    <?php

function my_function()
{
//In here you put code that will executed when the function is called
echo "Hello World";
}

//Calling the function
my_function();

?>


The output would be
    Hello World


Function Parameters

Function Parameters are arguments are passed by the function to the function code with a value
    <?php

//Here's a example $string This is argument for the function my_function
function my_function($string)
{
echo $string;
}

//Calling the function with the argument
my_function("Hello World");
?>


The output would be
    Hello World




This is the end of this tutorial of basic PHP in the future ill make another tutorial going into some more advanced PHP Example: MySql, Classes and more

Thanks for reading this tutorial was made by: Lachie444
Credits:
Kurt: For making want to learn PHP ages ago when he was selling his mod menu for GTA.
Jelly: For being gay asf


Apart from spelling/grammar, really good tutorial, coming from a person who's rarely looked into PHP. :p

The following user thanked Frosty for this useful post:

04-09-2016, 04:39 PM #6
Jon Snow
Di DonDadda
nice tutorial :yes:

The following user thanked Jon Snow for this useful post:

04-09-2016, 04:43 PM #7
Originally posted by Frosty View Post
Apart from spelling/grammar, really good tutorial, coming from a person who's rarely looked into PHP. :p


is got a disability when it comes to that stuff lol.
next time ill try better
04-09-2016, 04:46 PM #8
Originally posted by lachie444 View Post
is got a disability when it comes to that stuff lol.
next time ill try better


Hmm, from what I've seen, the best programmers/coders are the worst spellers lol. I'll have to look into PHP once I finish delving into Javascript :p

The following user thanked Frosty for this useful post:

04-09-2016, 04:58 PM #9
Toxic
former staff
Originally posted by lachie444 View Post
BASIC PHP [Level: Beginners]


Basic Syntax

Starting a PHP File
    <?php

//Your code could go here

?>



Comments
Comments are section or line of code that will not be executed in the Site

    <?php
//This is just a single line comment
/*
This is a multi line comment
*/
?>


Echo
Echo is a function that is built into php that is used to output text tot he screen you can aloes use it to output html code

    ?php
echo "Hello World";
?>


String Concatenation
String Concatenation is used to bind two string together this is helpful once you learn about variables

    <?php
echo "Hello " . "World";
?>

The output would be
    Hello World


Includes
Includes are used to add a php file inside another one so you can use there functions(we will do functions soon) and there variables

    <?php
include "login.php";
?>


Now that you know the basic Syntax of PHP we will move on to Variables



Variables

Basic Variable
A Basic Variable is used to store some type of value. to start off a variable in php you have to use a $ then after that you put what ever name you would like the Followed with a =
then the variable value
    <?php
$thename = "Hello World";

echo $thename;
?>


Constants
A Constant is a variable that can not be unset or changed once the code has been executed.
To start constant you use the function define()

    <?php
/*the define functions takes 3 parameters: name, value, case insensitive
Example*/
define("NGU", "isOnline");
// Using case insensitive
define("NGU1", "isOnline", true);
//You and aloes define Constants like this
const NGU2 = "isOnline";
?>


This you can store in a variable


  1. Int = A Number
  2. String = A word Example: "Hello World"
  3. Bool = True or False
  4. Float = 1.0
  5. Array = More then one value
  6. NULL = Nothing


This you can store in a variable
Arrays are variable that you can store more then 1 value in this is helpful when when returning data from a database

    <?php
$myarray = array(1 => "Lachie444", 2 => "Jelly");
echo $myarray[1];
?>


Now that you know the basic of variables we will move onto functions





Functions

Functions are helpful so you dont have to have the same code over and over again in your code and to call it in another file when included.

Basic Functions

To start off a function you use (function) followed by the name you would like end it with () Example [ function my_function() ]
    <?php

function my_function()
{
//In here you put code that will executed when the function is called
echo "Hello World";
}

//Calling the function
my_function();

?>


The output would be
    Hello World


Function Parameters

Function Parameters are arguments are passed by the function to the function code with a value
    <?php

//Here's a example $string This is argument for the function my_function
function my_function($string)
{
echo $string;
}

//Calling the function with the argument
my_function("Hello World");
?>


The output would be
    Hello World




This is the end of this tutorial of basic PHP in the future ill make another tutorial going into some more advanced PHP Example: MySql, Classes and more

Thanks for reading this tutorial was made by: Lachie444
Credits:
Kurt: For making want to learn PHP ages ago when he was selling his mod menu for GTA.
Jelly: For being gay asf


you only showed them numeric arrays, give them some examples associative arrays or multidimensional arrays :p
anyways, not bad tut for beginners :-)
04-09-2016, 05:10 PM #10
Originally posted by Habibi
you only showed them numeric arrays, give them some examples associative arrays or multidimensional arrays :p
anyways, not bad tut for beginners :-)


shit yea i forgot about that ill add it soon and thanks

Copyright © 2024, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo