Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit e5a0003

Browse files
initial
0 parents commit e5a0003

File tree

12 files changed

+325
-0
lines changed

12 files changed

+325
-0
lines changed

‎add_sub.php‎

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
3+
// +, -
4+
5+
$number = 1.5; // float
6+
$y = 5; //interger
7+
8+
//
9+
10+
11+
12+
print_r("\n");
13+
print_r("<br>");
14+
15+
// echo "The output of sub values : ";
16+
// print_r($y-$number);
17+
18+
19+
//
20+
// $sum = $number + $y;
21+
// print_r("<br>");
22+
// print_r($sum);
23+
24+
// $number = $number + $y;
25+
$number += $y;
26+
$number -= $y;
27+
28+
print_r("Sum number is".$number);
29+
30+
31+
32+
?>

‎concatenation.php‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
3+
$first_name = "Deepak";
4+
5+
6+
$last_name = "Kumar";
7+
8+
9+
// . $first_name . $last_name ---> My Name is Naveen Kumar.
10+
11+
print_r("<h1>My Name is ".$first_name."".$last_name.".</h1>");
12+
13+
?>

‎datatypes.php‎

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
2+
<!-- Integer, String, Float, Bool, Array, Object, -->
3+
4+
<!-- Integer -->
5+
<!-- 0,1,2,3... -->
6+
7+
<!-- Float -->
8+
<!-- 1.1, 1.5, 1.45 -->
9+
10+
<!-- String -->
11+
<!-- AbCD -->
12+
<!-- To write srtings in php we use ' -- ' & " -- " -->
13+
14+
<!-- Bool -->
15+
<!-- True & False -->
16+
17+
<!-- Array -->
18+
<!-- array = [] & new Array(); -->
19+
20+
<!-- array = [2, 2.5, "Deepak", False]; -->
21+
<!-- [1,2,34,] & [] & [] -->
22+
<!-- fruit_bucket = ['Mango', 'Apple', 'Banana', ...]; -->
23+
24+
<!-- Object -->
25+
<!-- {
26+
exericse_1 : intro,
27+
exercise_2 : chapter,
28+
exercise_3 : questions,
29+
} -->

‎else_if.php‎

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?php
2+
3+
// if(condition){
4+
// #code ..
5+
// }else if(other condition){
6+
// #code ..
7+
// }else{
8+
// #code ..
9+
// }
10+
11+
// $fruit = "Mango";
12+
13+
// if($fruit === 'Banana'){
14+
// echo "Yes, Selected fruit is banana";
15+
// }else if($fruit === 'Apple'){
16+
// echo "Not Selected fruit is not banana, its apple";
17+
// }else if($fruit === 'Mango'){
18+
// echo "Not Selected fruit is not banana, its mango";
19+
// }else{
20+
// echo "Its an undefined fruit";
21+
// }
22+
23+
$x = 40;
24+
$y = 20;
25+
26+
$given_number = 50;
27+
$sum = $x+$y;
28+
if($sum > $given_number){
29+
echo $sum." is greater then ". $given_number;
30+
}else if($sum === $given_number){
31+
echo $sum." is equal to ". $given_number;
32+
}else{
33+
echo $sum." is smaller then ". $given_number;
34+
}
35+
36+
37+
?>

‎hey.php‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?php
2+
3+
4+
echo "Hello World!!";
5+
6+
7+
8+
9+
?>

‎if.php‎

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?php
2+
3+
// if(condition){
4+
//
5+
//}
6+
7+
8+
$fruit = 'Banana';
9+
10+
if($fruit == "Mango"){
11+
echo "Yes, fruit is mango...";
12+
}
13+
14+
$number_1 = 10;
15+
16+
$number_2 = 10;
17+
18+
// if($number_1 == $number_2){
19+
// echo "Both number are equal";
20+
// }
21+
22+
if($number_1 === $number_2){
23+
echo "Yes, Both numbers are identical..";
24+
}
25+
26+
27+
28+
29+
?>

‎if_else.php‎

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?php
2+
3+
//if(condtition){
4+
// code..
5+
//}else{
6+
// code..
7+
//}
8+
9+
$fruit = "Banana";
10+
11+
if($fruit === "Mango"){
12+
echo "Yes, Selected fruit is Mango";
13+
}else{
14+
echo "No, Selected fruit is not Mango";
15+
}
16+
17+
print_r("\n");
18+
19+
$num = 30;
20+
21+
$num_1 = 20;
22+
23+
if($num > $num_1){
24+
echo "Yes, ".$num." is greater then ".$num_1;
25+
}else{
26+
echo $num." is not greater then ". $num_1;
27+
}
28+
29+
30+
?>

‎intro_operators.php‎

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<?php
2+
3+
// Equal to operator (==)
4+
5+
$num_1 = "10"; //String
6+
7+
$num_2 = 10; //integer
8+
9+
//--> $num_1 == $num_2 ///// True
10+
11+
/// Identical Operator (===)
12+
13+
//--> $num_1 === $num_2 ///// False
14+
15+
/// Not equal to operator (!=)
16+
17+
//--> $num_1 != $num_2 /// False
18+
19+
/// Not Identical Opearator (!==)
20+
21+
//--> $num_1 !== $num_2 /// False
22+
23+
/// greater (>)
24+
25+
//--> $num_1 > $num_2 /// True
26+
27+
/// smaller (<)
28+
29+
//--> $num_1<$num_2 /// False
30+
31+
/// greater equal (>=)
32+
33+
//--> $num_1 >= $num_2;
34+
35+
/// lessthen equal (<=)
36+
37+
// --> $num_1 <= $num_2 // True
38+
39+
/// Spaceship operator <=>
40+
41+
// --> $num_1 <=> $num_2
42+
43+
44+
45+
?>

‎mul_div.php‎

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?php
2+
3+
// x 5x6 = 30 , 5*6=30
4+
// Mul -- *
5+
6+
$x = 6;
7+
8+
$y = 10;
9+
10+
$x *= $y; // short hand method..
11+
echo "The product for both numbers are : ";
12+
print_r($x);
13+
print_r("<br>");
14+
15+
// 5/6 --- /
16+
$number_1 = 37;
17+
18+
$number_2 = 5;
19+
20+
$number_1 /= $number_2;
21+
echo "The Output of both number are : ";
22+
print_r($number_1);
23+
24+
25+
// Modules % .. 38%5=3.
26+
print_r("<br>");
27+
$num = 30;
28+
$num_1 = 5;
29+
30+
$num %= $num_1;
31+
echo "The modules of both the numbers are : ";
32+
print_r($num);
33+
34+
?>

‎task_1.php‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
// Write a program to add two numbers and sub 5 from there sum..
3+
4+
5+
$number_one = 40;
6+
7+
8+
$number_two = 25;
9+
10+
$sum = $number_one + $number_two;
11+
12+
echo " the sum of both numbers are: ";
13+
print_r($sum);
14+
print_r("\n");
15+
16+
$final_output = $sum - 5;
17+
echo "the final output of our program is: ";
18+
print_r($final_output);
19+
20+
21+
?>

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /