Php darslari informer uz



Yüklə 179,01 Kb.
səhifə2/2
tarix11.12.2023
ölçüsü179,01 Kb.
#148037
1   2
AKT javob

// Shartli operatorlar
html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Documenttitle>
head>
<body>
$rain = false;


if ($rain){
echo "uyda qolamiz";
echo "yomg'ir yog'di";
}
else{
echo"fudbolga boramiz";
echo "
";
}

$a=45;
$b=75;
if ($a>$b){

echo "a soni b sonidan kichik";
} else{
echo "a sonidan b soni katta";

}
echo "


";


$a=45;
$b=45;
if ($a>$b)
{
echo "a soni b sonidan kichik";
} elseif ($a===$b){
echo "a soniga b soni qiymati va tipi ham teng";
}
elseif ($a==$b){
echo "a soni b soniga teng";
}
else
{
echo "a sonidan b soni katta";
}

echo "
";

?>
body>
html>
// Shart operatorlari
html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Documenttitle>
head>
<body>
$ball=100.1;
if ( $ball<=40) {
echo "imtihondan yiqildingiz";
}elseif($ball>40 and $ball<70) {
echo "siz imtihondi qayta topshirishingiz mumkin";
}elseif ($ball>=70 && $ball<=100)
{
echo "siz imtihondan o'tgandingiz";
}else{
echo "siz mavjud bo'lmaga ball to'pladingiz yoki texnik xatolik sodir bo'lgan";
}


?>
body>
html>

html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Documenttitle>
head>
<body>
// while operatori
$i=0;
while($i<=15){
echo $i, " ";
$i++;
if ($i==8){
break;
}

}


?>
body>
html>

//Assotsiatsiv massivlar
$students=array('ismi'=>'Elmurod', 'manzili'=>'Qashqadaryo', 'raqami'=>991249341);
echo "
";
//print_r($students);

echo $students['ismi'];
?>

html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Documenttitle>
head>
<body>
//Ko'p o'lcahmli massivlar

$array=[
[[15,35], [86,78]],
['salom hayot', 'php dasturlash', 19],
[36, 75]
];
echo "
";
print_r($array);
echo $array[0][1][0];
//echo $array[2][1];
?>
body>
html>


html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Documenttitle>
head>
<body>
//Funksiyalar chaqrib qo;yish kerak

function myFirstFunc(){

echo "bu mening birinchi funcsiyam";
}
//myFirstFunc();

function addnumbers(){
$a=35;
$b=75;
return "hello world";

}
$c=addnumbers();



echo $c;
?>
body>
html>

html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Documenttitle>
head>
<body>

function test($name, $age=21)
{
echo "salom $name, yoshingiz $age da";
}
$ism = "elmurod";

test("Elti ");



?>
body>
html>
html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Documenttitle>
head>
<body>

// masvivlar bilan ishlash
// count - elementlar soni

$str = [45, 78, 76, 77, 89];

echo count($str);


?>
body>
html>

html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Documenttitle>
head>
<body>

// isset() -qiymatini chiqaradi
//epmty()-qiymatini bor yo'qligini aniqlaydi
//$var="";
//
//if (isset($var)){
// echo "o'zgaruvchi elon qilingan";
//}else{
// echo "bunday o'zgaruvchi e'lon qilingan emas";
//}
$var="salom";

if (empty($var)){
echo "o'zgaruvchiga qiymat berilmagan";
}else{
echo "o'zgaruvchi berilgan";
}

?>
body>
html>



include 'Telegram.php';



$telegram = new Telegram('6223011380:AAFxv-g4SWQoyjUZZ0wIElA5X-k85rIpP4Y');

$chat_id = $telegram->ChatID();
$text =$telegram->Text();

if ($text="/start"){



$option = array(
//First row
array($telegram->buildKeyboardButton("🛏 Mebellar")),
//Second row
array($telegram->buildKeyboardButton("🛏 Batafsil ma'lumot"))
);
$keyb = $telegram->buildKeyBoard($option, $onetime=true, $resize=true);

$content = array('chat_id' => $chat_id, 'text' => "Assallamu allaykum. Bizning botimizga xush kelibsiz!");
$telegram->sendMessage($content);

$content = array('chat_id' => $chat_id, 'reply_markup' => $keyb, 'text' => "Bizning telegram botimiz orqali siz o'zingizga yoqqan buyumlarni xarid qilishingiz mumkin. Biz sizga xizmat ko'satganimizdan mamnunmiz. Bizning bot orqali yana xarid qiling va do'stlaringizga ham bizning botimizning qulayliklari haqida gapirib bering!");
$telegram->sendMessage($content);
}elseif ($text ="🛏 Batafsil ma'lumot"){
$content = array('chat_id' => $chat_id, 'text' => "Mebel haqida ma'lumot, ", 'parse_mode'=>"html");
$telegram->sendMessage($content);

}

// OOP object, proporty, method
class Robot{

public $height = '180 sm';

public function speak(){



echo "Bu robotimiz zo'r gapira oladi";
}
}

$bot=new Robot();

//var_dump($bot);

echo $bot->height;
echo "
";

echo $bot->speak();


class Edi{
protected $Eltin;

/**
*
@return mixed
*/
public function getEltin()
{
return $this->Eltin;
}
public function setEltin($Eltin){
$this->Eltin=$Eltin;
}
public function test(){
echo "test sinovvi";
}
}

$student1=new Edi;
$student1->setEltin("Dilshodbek");
echo $student1->getEltin();

class Person{
public $hand=2;

public function walk(){


echo "person klassi walk metodi";
}
}

class Student extends Person{
public $group="Web dasturlash";

public function teach(){


echo "student teach merodi";
}
}

$s1=new Student();

$s1->walk();
echo $s1->group;

class Person{
protected $hand=2;

public function walk(){


echo "person klassi walk metodi";
}
}

class Student extends Person{
public $group="Web dasturlash";

public function teach(){


echo $this->hand;
echo "student teach merodi";
}
}

$s1=new Student();

$s1->walk();
$s1->teach();

class Person{
public function __construct()
{
echo "bu person klassining constructori";
}

protected $hand=2;

public function walk(){


echo "person klassi walk metodi";
}
}

class Student extends Person{

public function __construct(){
echo "student KLASSINNIng constructor metodini ishga tushirdi";
}
public $group="Web dasturlash";

public function teach(){


echo $this->hand;
echo "student teach merodi";
}
}
$p1=new Person();
echo "
";
$s1=new Student();

class Person{
public function __construct()
{
echo "bu person klassining constructori";
}

protected $hand=2;

public function walk(){


echo "person klassi walk metodi";
}
}

class Student extends Person{

public function __construct(){
parent::__construct();
echo "
";
echo "student KLASSINNIng constructor metodini ishga tushirdi";
}

public function __invoke(){
echo "invoke metodi ishga tushdi";
}

public function __toString(){
return " to String metodi";
}
public $group="Web dasturlash";

public function teach(){


echo $this->hand;
echo "student teach merodi";
}
}
//$p1=new Person();
echo "
";
$s1=new Student();
// $s1();

//echo $s1;



class Company{


public function calcMaosh($obj){
$obj->maosh();
}
}

class Teacher{
public $name;
public function __construct($name){
$this->name=$name;
}
public function maosh(){
echo "$this->name o'qituvchini oyligini xisoblash logikasi";
}
}

class Manager{
public function maosh()
{
echo "manager uchun oylik ishlash logikasi";
}
}

$teacher=new Teacher("Elmurod");
$manager=new Manager();

$company=new Company();

$company->calcMaosh($teacher);

Laravel API


https://www.youtube.com/watch?v=Sy8UuZ0QU-E&list=PLlvUmyq_t3vw9WMsVGtiMSXRw2N1Etg5w

 Savatchaga qo'shish, Savatcha funksiyasi | Laravelda Backend API yaratish


https://www.youtube.com/watch?v=Y32R34M-dgc







Yüklə 179,01 Kb.

Dostları ilə paylaş:
1   2




Verilənlər bazası müəlliflik hüququ ilə müdafiə olunur ©genderi.org 2024
rəhbərliyinə müraciət

    Ana səhifə