Sunday, September 12, 2010

PHP Variable



  • Variable is name to the memory location.its a one kind of container which hold any type of data to perform operation on it. php variables doesn't need to specify which type of variable we would like to declare.
  • Variables are used for storing values, such as numbers, strings or function results, so that they can be used many times in a script.
  • When a variable is set it can be used over and over again in your script.
  • All variables in PHP start with a $ sign symbol.
  • Example : $var_name = value;New PHP programmers often forget the $ sign at thebeginning of the variable. In that case it will not work.
  • PHP is a Loosely Typed Language so, In PHP a variable does not need to be declared before being set.
  • PHP automatically converts the variable to the correct data type, depending on how they are set.
  • In a strongly typed programming language, you have to declare (define) the type and name of the variable before using it.
  • In PHP the variable is declared automatically when you use it.
  • Example : $value=25 


    Rules for Constructing PHP variable:
    • Must always begin with a dollar-sign ($).
    • Generally start with a letter and can contain letters, numbers, and underscore characters “_”.
    • Values can be numbers, strings, boolean, etc....
    • Names are case sensitive.
    • value gets change as the program executes.


    PHP supports eight primitive data types :

    Four scalar types:
    • Boolean
    • Integer
    • Float
    • String
    Two compound types:
    • Array
    • Object
    Two special types:
    • Resource
    • Null




          5 comments:

          1. The internet contains many exciting effects so when you start thinking about your website it's easy for your mind to wander off into a world of visual animations and flashy widgets. Webdesign

            ReplyDelete
          2. Do they have previous examples and testimonies from past clients? Webdesign Limburg

            ReplyDelete
          3. Also there are some restrictions that make communication with the buyer a little difficult, and they don't offer bank wire withdraw - which I like to use. Their fee is 18%, one more reason for me not to use it to much. Webdesignbetaalbaar.be

            ReplyDelete
          4. The best solution to this problem is to just simply have 2 domain names. One for print and one for ranking. Have your print domain redirected to the keyword rich domain name and you get the best of both worlds. Webdesignprofessioneel.be

            ReplyDelete
          5. Not all colors work well on the Internet. Generally, selecting a few colors is the best path to take. Your web designer can help you select quality colors that will come together in a design that you will be proud to show off. Webdesigner Antwerpen

            ReplyDelete