Page 55 - Open Soource Technologies 304.indd
P. 55

Unit 2: Language Basics



            Logical operators: Logical operators provide ways for you to build complex logical expressions.   Notes
            Logical operators treat their operands as Boolean values and return a Boolean value.
            Null: Null is a special data type which can have only one value, which is it. Which is to say, null
            is not only a data type, but also a keyword literal.
            Object: An object is a data type that allows for the storage of not only data but also information
            on how to process that data. The data elements stored within an object are referred to as its
            properties, also sometimes called the attributes of the object.
            Operator: An operator is a code element that acts on an expression in some way. For instance,
            a minus sign can be used to tell the computer to delete the value of the expression after it from
            the expression before it.
            Parameters: A parameter is a local variable whose value is passed to the function by the calling
            code. Unlike other variables, parameters are declared in a parameter list as part of the function
            declaration.
            Variable: A variable is just a name assigned to reference a location in memory where some value
            is stored. It is a shortcut, so that you do not have to refer to memory addresses directly.

                          1.  Develop a program to show the use of variables in PHP.

                          2.  Develop a program to show the use of arithmetic operators in PHP.

            2.8 Review Questions


               1.  What do you mean by lexical structure?
               2.  Explain the delimiters and Literals in PHP with example.
               3.  How many data types are used in PHP? Explain with example.
               4.  What are the special character and here documents in PHP? Discuss briefly.
               5.  Explain the compound data types used in PHP.
               6.  What are the variables? How many variables are used in PHP?
               7.  Explain about the scope of variables. How are they defined in PHP?
               8.  What are the expressions? Why these are used in PHP? Give the example.
               9.  What are the operators? How many operators are used in PHP?
              10.  What are the difference between assignment operators and comparison operators? Explain
                 with example.
            Answers to Self Assessment

               1.  (b)    2.  (a)       3.  (c)      4.  (b)        5.  (d)
               6.  (c)    7.  (d)       8.  (a)      9.  (a)       10.  (b)

            2.9 Further Reading




                          Learning PHP 5, by David Sklar




                          http://www.phpcatalyst.com/


                                             LOVELY PROFESSIONAL UNIVERSITY                                    49
   50   51   52   53   54   55   56   57   58   59   60