Untitled

 avatar
unknown
plain_text
a year ago
2.2 kB
13
Indexable
// --------------------------------------------------------------------------------
// ACTIVITY 6
// echo "<h1><u>ACTIVITY 6</u></h1>";
// $text = "Blk<font color='red'>15</font>, Lot <font color='red'>5</font>, Brgy.<font color='red'>146</font> Dalayap, Quezeon City";
// $total = 0;
// for($x = 0; $x < strlen($text); $x++){
//     if (ctype_digit($text[$x])) { 
//         $total += $text[$x];
//     }
// }
// echo $text . '<br>';
// echo "Total sum from text is: <font color='red'><u> $total </u></font><br><br>";
// --------------------------------------------------------------------------------
// ACTIVITY 7
// echo "<h1><u>ACTIVITY 7</u></h1>"; 
// $total = 0;
// $j = '';
// for ($i = 1; $i < 100; $i++) {
//     if ($i % 2 == 1) {
//         if($j < 1 ){
//             $j .= $i;
//             echo "Odd Number: $j <br>";
//             $total += $i;
//             echo " Current Total: <font color='red'> $total </font><br>";
//         }
//         else{
//             $j .= ', ' . $i;
//             echo "Odd Number: $j <br>";
//             $total += $i;
//             echo " Current Total: <font color='red'> $total </font><br>";
//         }
//     }
// }

// for ($i = 1; $i < 100; $i+=2) {
//     if($j <1 ){
//         $j .= $i;
//         echo "Odd Number: $j <br>";
//         $total += $i;
//         echo " Current Total: <font color='red'> $total </font><br>";
//     }
//     else{
//         $j .= ', ' . $i;
//         echo "Odd Number: $j <br>";
//         $total += $i;
//         echo " Current Total: <font color='red'> $total </font><br>";
//     }
// }
// echo '<br><br>';

// $total = 0;
// $oddNumbers = [];

// for ($i = 1; $i < 100; $i += 2) {
//     $oddNumbers[] = $i;     //[1,3,5]
//     $j = implode(', ', $oddNumbers);
//     echo "Odd Number: $j <br>";
//     $total += $i;
//     echo "Current Total: <font color='red'> $total </font><br>";
// }
// echo "<br>";

// --------------------------------------------------------------------------------
// ACTIVITY 8
echo "<h1><u>ACTIVITY 8</u></h1>"; 
for ($y = 1; $y <= 9; $y++){
    for ($z = 1; $z <= $y; $z++){
        echo '*';
    }
    echo  '<br>';
}

// *
// ** 
// 
Editor is loading...
Leave a Comment