AllInWorld99 provides a reference manual covering many aspects of web programming, including technologies such as HTML, XHTML, CSS, XML, JavaScript, PHP, ASP, SQL,FLASH, jQuery, java, for loop, switch case, if, if else, for...of, for...in, for...each,while loop, blogger tips, blogger meta tag generator, blogger tricks, blogger pagination, client side script, html code editor, javascript editor with instant output, css editor, online html editor, materialize css tutorial, materialize css dropdown list,break, continue statement, label,array, json, get day and month dropdown list using c# code, CSS button,protect cd or pendrive from virus, cordova, android example, html and css to make android app, html code play,telerik show hide column, Transparent image convertor, copy to clipboard using javascript without using any swf file, simple animation using css, SQL etc. AllInWorld99 presents thousands of code examples (accompanied with source code) which can be copied/downloaded independantly. By using the online editor provided,readers can edit the examples and execute the code experimentally.


      If you have never had any programming, Algebra, or scripting experience, then the concept of variables might be a new concept to you. A detailed explanation of variables is beyond the scope of this tutorial, but we have included a refresher crash course to guide you.

      A variable is a means of storing a value, such as text string "Hello World!" or the integer value 4. A variable can then be reused throughout your code, instead of having to type out the actual value over and over again. In PHP you define a variable with the following form:

$variable_name = Value;

      If you forget to put dollar sign at the beginning, it won't work. This is a common mistake for all new PHP programmers.


A Quick Variable Example


      Say that we wanted to store the values that we talked about in the above paragraph. How would we go about doing this? We would first want to make a variable name and set that equal to the value we want. see the below example

PHP Code:
 <?php
    $hello = "Hello World!";
    $a_number = 4;
    $anotherNumber = 8;
?>


   Note for programmers: PHP does not require variables to be declared before being initialized.


PHP Variable Naming Conventions

    There are a few rules that you need to follow when choosing a name for your PHP variables.
  • variables should start with a letter or underscore "_"
  • variables may only be comprised of alpha-numeric characters and underscores.A-Z, 0-9, a-z,  or _(underscore)
  •  Variables with more than one word must be separated with underscores. $phpvariable 
  •  Variables with more than one word can also be distinguished with capitalization. $phpVariable


0 comments:

Post a Comment

Total Pageviews