[Home]  [Edit this page]  [Recent Changes]  [Special Pages]  [Help
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



last edited (May 17, 2006) by bilderbikkel, Number of views: 2915, Current Rev: 2 (Diff)

[Edit this page]  [Page history]  [What links here]  [Discuss this topic]  [Printer Friendly]  

Members

Username:

Password:


Register
Forgot Password?




Programmers Heaven - for .NET, Java, C/C++ and WEB Developers!
© 1996-2008 Community Networks Ltd. All rights reserved. Reproduction in whole or in part, in any form or medium without express written permission is prohibited. Violators of this policy may be subject to legal action. Please read Terms Of Use and Privacy Statement for more information. Development by Tore Nestenius at .NET Consultant - Synchron Data.