ITEM413/ITWA133 Laboratory Activity No.

3 – Working with Data Types and Operators
1.
2. Copy the code from your lab2.php and save it as lab3.php (ex. C:\xampp\htdocs\nuarin\lab3.php) and remove the PHP code in your content section. Set the value of the following constants: define('LABTITLE', 'Laboratory Activity No. 3'); define('DESCRIPTION', 'Working with Data Types and Operators');

3.
4.

Update your navigation section to include your lab3.php. Declare the following variables and initialize the values using assignment operator (=): VARIABLE $myinteger $myfloat $mystring $myboolean $mynull $myarray VALUE 10 10.57 '10 apples' TRUE NULL array(1,2,3)

5.

In the content section of your template, print the following expressions and execute the function var_dump(<expression>) to display the result. Place each operator category in a separate table. Item 1a and 2b are already given as an example. echo '<tr><td>1a. $myinteger</td><td>', var_dump($myinteger), '</td></tr>'; echo '<tr><td>2a. $myinteger + 10</td><td>', var_dump($myinteger + 10), '</td></tr>'; 1. PHP Data Types 1a. $myinteger 1b. $myfloat 1c. $mystring 1d. $myboolean 1e. $mynull 1f. $myarray 2. PHP Arithmetic Operators 2a. $myinteger + 10 2b. $myinteger – 5 2c. $myinteger * 2 2d. $myinteger / 3 2e.$myboolean + 1 2f. $mystring * 2 3. PHP Bitwise Operators 3a. $myinteger & 8 3b. $myinteger | 8 3c.$myinteger << 1 3d. $myinteger >> 1 4. PHP Comparison Operators 4a. $myinteger == 10 4b. $myinteger > 10 4c. $myinteger >= 10 4d.$myinteger < 20 4e. $myinteger <= 20 4f. $myinteger == $mystring 4g. $myinteger === $mystring 5. PHP Logical Operators 5a. $myinteger >= 10 and $myinteger <= 20 5b. $myinteger == 10 or $myinteger == 20 5c. $myinteger == 10 xor $myinteger == 20

6. 7.
8.

Test your PHP script using your browser (Ex. http://localhost/cansino/lab3.php) Upload your script to your 000webhost.com domain. Good Luck and Happy Coding!

Sign up to vote on this title
UsefulNot useful