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

Ray's coding forum for teaching, sharing, and learning.
 
HomeHome  FAQFAQ  SearchSearch  MemberlistMemberlist  UsergroupsUsergroups  RegisterRegister  Log in  

Share | 
 

 [TuT]PhP Variables[TuT]

Go down 
AuthorMessage
Ray
God Ray
God Ray
avatar

Posts : 36
Code Tokens : 20373
Join date : 2013-05-02
Age : 20
Location : North America

PostSubject: [TuT]PhP Variables[TuT]   Wed 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
View user profile http://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: