[Home]
[Edit this page]
[Recent Changes]
[Special Pages]
[Help]
phpvariables
Anytime you need to declare a variable you precede it with a $ (dollar sign). Once you have variables you need to do something with them. Often times you need to display the contents of a variable, as shown below.
As you can see there are two ways to display stuff in PHP, print and echo.
Well it's as simple as that! Now get coding!
Back to the PHP section
[Edit this page] [Page history] [What links here] [Discuss this topic] [Printer Friendly]
phpvariables
(PHP) Working with variables
In PHP there are no variable declarations, as shown below.// not in PHP int x = 0; // this is how it is done in PHP $x = 0;
Anytime you need to declare a variable you precede it with a $ (dollar sign). Once you have variables you need to do something with them. Often times you need to display the contents of a variable, as shown below.
<?php $good_morning = "Good morning, I hope you had a good nights rest!"; // one way of displaying stuff print($good_morning); // another way of displaying stuff echo $good_morning; ?>
As you can see there are two ways to display stuff in PHP, print and echo.
Well it's as simple as that! Now get coding!
Back to the PHP section
Variables in other languages
[Edit this page] [Page history] [What links here] [Discuss this topic] [Printer Friendly]
