-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b1ac5b9
commit 9f88d41
Showing
10 changed files
with
281 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<?php | ||
|
||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
<?php | ||
|
||
class player{ | ||
public $name = "null"; | ||
public $speed = 5; | ||
public $running = false; | ||
|
||
// function __construct($name){ | ||
// $this->name = $name; | ||
// $this->speed = $s; | ||
// $this->running = true; | ||
// } | ||
|
||
function __construct($name = "Farhad Name"){ | ||
$this->name = $name; | ||
// $this->speed = $s; | ||
$this->running = true; | ||
} | ||
function __destruct(){ | ||
echo "hello destruct <br>"; | ||
} | ||
|
||
function set_name($name){ | ||
$this->name = $name; | ||
} | ||
|
||
function get_name(){ | ||
return $this->name; | ||
} | ||
function get_run(){ | ||
return $this->running = true; | ||
} | ||
function stopRun(){ | ||
return $this->running = false; | ||
} | ||
} | ||
|
||
$p1 = new player("Farhad"); | ||
|
||
$p2 = new player("Foysal"); | ||
|
||
$p1->set_name("Farhad Foysal");. | ||
$p2->set_name("Farhad MOni"); | ||
|
||
echo $p1->get_name()." <br>".$p2->get_name()."<br>".$p2->get_run()."<br>"; | ||
|
||
$p3 = new player("Moni"); | ||
|
||
echo $p3->name."<br>"; | ||
|
||
$p4 = new player("constractor_name"); | ||
|
||
echo $p4->name."<br>"; | ||
|
||
$p5 = new player(""); | ||
|
||
|
||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php | ||
|
||
|
||
$cat = $_COOKIE['category']; | ||
|
||
echo $cat; | ||
|
||
|
||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<?php | ||
|
||
setcookie("category", "Books", time() + 86400, "/"); | ||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?php | ||
|
||
date_default_timezone_set("Asia/Dhaka"); | ||
$today=date("Y-m-d"); | ||
$time= date("h:i:s"); | ||
|
||
|
||
$dateef = strtotime($today); | ||
|
||
$monthh = date('m', $dateef); | ||
$yearr= date('Y', $dateef); | ||
|
||
$mon = date('m', $dateef); | ||
$yea= date('Y', $dateef); | ||
|
||
|
||
|
||
$ran_id = rand(time(), 1000000000); | ||
$referr = strtoupper(bin2hex(random_bytes(1))); | ||
|
||
$d = date("l"); | ||
echo "today is $d <br>"; | ||
$d = date("d l"); | ||
echo "today is $d <br>"; | ||
$d = date("d D"); | ||
echo "today is $d <br>"; | ||
$d = date("l dS F Y"); | ||
echo "today is $d <br>"; | ||
$d = date("l dS F Y, g:i A"); | ||
echo "today is $d <br>"; | ||
$d = date("l dS F Y h:i:s A"); | ||
echo "today is $d <br>"; | ||
|
||
|
||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
<?php | ||
|
||
echo readfile("index.txt"); | ||
echo "<br>"; | ||
readfile("index.txt"); | ||
|
||
echo "<br>"; | ||
|
||
$fopen = fopen("index.txt", "r"); | ||
|
||
echo var_dump($fopen); | ||
|
||
if(!$fopen){ | ||
die("unable to open this file. please enter valid filename"); | ||
} | ||
|
||
|
||
// $content = fread($fopen, 70); | ||
|
||
$content = fread($fopen, filesize("index.txt")); | ||
fclose($fopen); | ||
|
||
echo $content."<br>"; | ||
|
||
$fopen = fopen("index.txt", "r"); | ||
// echo fgets($fopen)."<br>"; | ||
// echo fgets($fopen)."<br>"; | ||
// echo fgets($fopen)."<br>"; | ||
|
||
// while($a=fgets($fopen)){ | ||
// echo $a."<br>"; | ||
// } | ||
|
||
// while($a=fgetc($fopen)){ | ||
// echo $a." "; | ||
|
||
// } | ||
|
||
|
||
while($a=fgetc($fopen)){ | ||
echo $a." "; | ||
if($a==".."){ | ||
break; | ||
} | ||
} | ||
echo "<br>"; | ||
|
||
fclose($fopen); | ||
|
||
$fopen = fopen("index.txt", "w"); | ||
fwrite($fopen, "This is the best file on this planet. Please don't argue with me on this one."); | ||
|
||
fwrite($fopen, "This is another content, This is the best file on this planet. Please don't argue with me on this one."); | ||
|
||
fwrite($fopen, "write three.\n"); | ||
fclose($fopen); | ||
|
||
|
||
$fopen = fopen("index.txt", "a"); | ||
fwrite($fopen, "This is the best file on this planet. Please don't argue with me on this one."); | ||
|
||
fwrite($fopen, "This is another content, This is the best file on this planet. Please don't argue with me on this one."); | ||
|
||
fwrite($fopen, "write three.\n"); | ||
fclose($fopen); | ||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
This is the best file on this planet. Please don't argue with me on this one.This is another content, This is the best file on this planet. Please don't argue with me on this one.write three. | ||
This is the best file on this planet. Please don't argue with me on this one.This is another content, This is the best file on this planet. Please don't argue with me on this one.write three. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<p>php function</p> | ||
<?php | ||
function processMarks($marksA){ | ||
$sum = 0; | ||
foreach($marksA as $value){ | ||
$sum+=$value; | ||
} | ||
return $sum; | ||
} | ||
|
||
$farhad = [40,50,60,70,80,90,100]; | ||
$sumMarks = processMarks($farhad); | ||
|
||
$foysal = [30,20,10,40,50,60,70]; | ||
$sumMarksf = processMarks($foysal); | ||
echo "Total marks by farhad is $sumMarks <br> "; | ||
echo "Total marks by foysal is $sumMarksf "; | ||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<p>php function</p> | ||
<?php | ||
function processMarks($marksA){ | ||
$sum = 0; | ||
foreach($marksA as $value){ | ||
$sum+=$value; | ||
} | ||
return $sum; | ||
} | ||
|
||
$farhad = [40,50,60,70,80,90,100]; | ||
$sumMarks = processMarks($farhad); | ||
|
||
echo $sumMarks; | ||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
<?php | ||
|
||
|
||
$arr = array('this', 'that', 'what'); | ||
|
||
echo "Array : $arr[0] , $arr[1] , $arr[2] <br>"; | ||
|
||
$arr = ['this', 'that', 'what']; | ||
|
||
echo "Array : $arr[0] , $arr[1] , $arr[2] <br>"; | ||
|
||
$associate = array( | ||
'farhad' => 'hi', | ||
'foysal' => 'hello', | ||
'moni' => 'assalamualaikum', | ||
5=> 'WalaikumAssalam' | ||
); | ||
|
||
echo "Farhad : ".$associate['farhad']. ", Foysal : " .$associate['foysal']. ", Moni : " .$associate['moni'] ; | ||
|
||
|
||
echo "<br> $associate[5] <br>"; | ||
|
||
foreach($associate as $key => $value){ | ||
echo "User ~ $key : $value <br>"; | ||
} | ||
|
||
$multiArray = array( | ||
array(2,5,7,8), | ||
array(1,3,6,5), | ||
array(4,5,9,6), | ||
array(2,3,1,2)); | ||
|
||
// echo var_dump($multiArray); | ||
|
||
// echo $multiArray[1][0]; | ||
for($i=0; $i<count($multiArray); $i++){ | ||
echo var_dump($multiArray[$i]); | ||
echo "<br>"; | ||
} | ||
|
||
for($i=0; $i<count($multiArray); $i++){ | ||
for($j = $i; $j<count($multiArray[$i]); $j++){ | ||
echo " ".$multiArray[$i][$j]; | ||
} | ||
echo "<br>"; | ||
} | ||
|
||
for($i=0; $i<count($multiArray); $i++){ | ||
for($j = $i; $j<count($multiArray[$i]); $j++){ | ||
echo "".$multiArray[$j][$i]." "; | ||
} | ||
echo "<br>"; | ||
} | ||
|
||
for($i=0; $i<count($multiArray); $i++){ | ||
for($j = 0; $j<count($multiArray[$i]); $j++){ | ||
echo " ".$multiArray[$i][$j]; | ||
} | ||
echo "<br>"; | ||
} | ||
|
||
|
||
|
||
|
||
?> |