Ray's Coding
Welcome to Ray's free coding forum! Here we help people learn to code, and share knowledge of coding.

Please feel free to sign up and begin your learning,teaching or sharing adventure!
Ray's Coding
Welcome to Ray's free coding forum! Here we help people learn to code, and share knowledge of coding.

Please feel free to sign up and begin your learning,teaching or sharing adventure!
Ray's Coding
Would you like to react to this message? Create an account in a few clicks or log in to continue.
Ray's Coding

Ray's coding forum for teaching, sharing, and learning.
 
HomeHome  Latest imagesLatest images  SearchSearch  RegisterRegister  Log in  

 

 [TuT]PhP Variables[TuT]

Go down 
AuthorMessage
Ray
God Ray
God Ray
Ray


Posts : 36
Code Tokens : 40343
Join date : 2013-05-02
Age : 25
Location : North America

[TuT]PhP Variables[TuT] Empty
PostSubject: [TuT]PhP Variables[TuT]   [TuT]PhP Variables[TuT] EmptyWed May 08, 2013 3:34 am

PhP Variables




Ok guys, today I'm going to attempt to throughly explain to you what variables are used for in PHP.

Variables are basically a storage, you can use them to store a string of text or anything else you'd life pratically.

A example of a variable storing a string of text:
PHP Code:
Code:

<?PHP
$text = "I am storing text";
?>


To display the text on the site you'd call the variable out.

Example:

PHP Code:
Code:

<?php

$text = "I am storing text";

echo $text

?>

How to store a integer you ask? Well here you are!
PHP Code:
Code:

<?PHP

$int1 = 9000;

?>

To display this we call it out, like this:
PHP Code:
Code:

<?PHP

echo $int1;

?>


Now before someone judges me and says that the code above is wrong, I want to make it known that a fundamental of php is that the last line of a php code does not require the semicolon at the end.

Anyhow, that is basically how you'd store text in a PHP variable and later call it out, you can change the value of the variable anytime also.

PHP can also hold more than text in variables, such as integers. Integers are basically just numbers. Just as 1,2,3,4,5 and what not.

Another fundamental of PHP is that you don't have to deem your variables string or boolean or int when your creating a variable. Other languages make you do this.



If you require additional information post below.[/center][/i][/b]
Back to top Go down
https://rayscoding.forumotion.com
 
[TuT]PhP Variables[TuT]
Back to top 
Page 1 of 1

Permissions in this forum:You cannot reply to topics in this forum
Ray's Coding :: Coding :: PHP-
Jump to: