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

Web Technologies-I



                   Notes         echo $name1, $age1, “\n”;
                                 echo $name2, $age2, “\n”;
                                 ?>
                                 If we do not assign a literal to a variable, there is no way how we can work with it. It is dropped.
                                 $ php literals.php

                                 Piyush 22
                                 Rahul 22
                                 Piyush 25

                                 Seema 24
                                 This is the output of the literals.php script.
                                 Operators

                                 An operator is a symbol used to perform an action on some value.
                                 +    –    *    /    %    ++    ––
                                 =    +=   –=   *=   /=   .=    %=

                                 ==   !=   ><   >   <   >=   <=
                                 &&   ||   !   xor   or
                                 &    ^    |   ~   .   <<   >>
                                 These are PHP operators.

                                 Delimiters
                                 A delimiter is a sequence of one or more characters used to specify the boundary between separate,
                                 independent regions in plain text or other data stream.
                                 $a = “PHP”;
                                 $b = ‘Java’;

                                 The single and double characters are used to mark the beginning and the end of a string.
                                 function setDate($date) {
                                     $this->date = $data;
                                 }

                                 if ( $a > $b) {
                                     echo “\$a is bigger than \$b”;

                                 }
                                 Parentheses are used to mark the function signature. The signature is the function parameters.
                                 Curly brackets are used to mark the beginning and the end of the function body. They are also
                                 used in flow control.
                                 $a = array(1, 2, 3);

                                 echo $a[1];
                                 The square brackets are used to mark the array index.




        26                                LOVELY PROFESSIONAL UNIVERSITY
   27   28   29   30   31   32   33   34   35   36   37