Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $a = 2;
- $name = "Alamin Shaheen";
- $age = 23;
- $num1 = 100;
- $num2 = 5000;
- $num3 = 30;
- // strlen gives string length
- // echo strlen($name);
- // condition
- // if($num1 % 2 == 0) echo "Even";
- // else echo "Odd";
- // if($num1 > $num2 && $num1 > $num3) echo "Num1 is highest";
- // else if($num2 > $num1 && $num2 > $num3) echo "Num2 is highest";
- // else echo "Num3 is highest";
- // if($age == 23 || $name == "Alamin Shaheen")
- // {
- // echo "Found";
- // }
- // else if(a == 2)
- // {
- // echo "congrats!"
- // }
- // else echo "Not found";
- // the "===" operator checks if both the value and type are same
- // if($name === "Alamin Shaheen")
- // {
- // echo "Found";
- // }
- // else
- // {
- // echo "Not found";
- // }
- // functions
- // function can be called before function is made
- // echo greet("Alamin", "Shaheen");
- // echo checker(100);
- // function checker($num)
- // {
- // if($num % 2 == 0) return "Even";
- // else return "Odd";
- // }
- // function greet($name1, $name2)
- // {
- // return $name1." ".$name2;
- // }
- // echo greet("Alamin", "Shaheen");
- // loops
- // for($i = 0; $i < 100; $i++)
- // {
- // echo "Md. Alamin Shaheen"."<br>";
- // }
- // $i = 1;
- // while($i <= 10)
- // {
- // echo $i." ";
- // $i++;
- // }
- // do
- // {
- // echo $i;
- // $i++;
- // }while ($i < 11);
- // switch case
- // $i = 8;
- // switch ($i) {
- // case 1:
- // echo "1";
- // break;
- // case 2:
- // echo "2";
- // break;
- // default:
- // echo "Kichu nai";
- // break;
- // }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement