-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtask2.php
More file actions
40 lines (38 loc) · 1.72 KB
/
task2.php
File metadata and controls
40 lines (38 loc) · 1.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
// ── Personal Information Variables ──
$first_name = "Joshua";
$last_name = "Mativo";
$full_name = $first_name . " " . $last_name;
$reg_number = "ENE212-0071/2023";
$year_of_study = 3;
$current_gpa = 3.50;
$is_registered = true;
$scholarship = null;
// ── Display with echo and labels ──
echo "Name: $full_name<br>";
echo "Reg No: $reg_number<br>";
echo "Year: $year_of_study (Type: " . gettype($year_of_study) . ")<br>";
echo "GPA: $current_gpa (Type: " . gettype($current_gpa) . ")<br>";
echo "Registered: " . ($is_registered ? '1' : '0') . " (Type: " . gettype($is_registered) . ")<br>";
echo "Scholarship: (empty) (Type: " . gettype($scholarship) . ")<br>";
echo "──────────────────────────────<br>";
// ── var_dump of all variables ──
echo 'var dump output:<br>';
echo "<pre>";
var_dump($full_name, $year_of_study, $current_gpa, $is_registered, $scholarship);
echo "</pre>";
echo "──────────────────────────────<br>";
// ── String quoting difference ──
echo "string quoting difference:<br>";
echo "<br>";
echo 'Hello $first_name<br>'; // No variable expansion
echo "Hello $first_name<br>"; // Variable expanded
echo "GPA: {$current_gpa}<br>"; // Curly brace syntax
echo "──────────────────────────────<br>";
// ── PHP Predefined Constants ──
echo "<br>";
echo 'PHP Predefined Constants:<br>';
echo "<br>";
echo "PHP_INT_MAX: " . PHP_INT_MAX . "<br>";
echo "PHP_FLOAT_EPSILON: " . PHP_FLOAT_EPSILON . "<br>";
echo "PHP_EOL (newline char): visible as a line break<br>";