Yangi formatda davom etish uchun: https://uzfor.net/view.php?act=post&id=60471
Postga havola
NetLizard [1846] [ban]
Hammaga salom.
Demak yana davom ettiramiz.
PHP DATA TYPES:
String
Integer
Float (floating point numbers - also called double)
Boolean
Array
Object
NULL
Resource
PHP String namuna:
*- yani matnli ozgaruvchilar, string deb ataladi.
PHP Integer namuna:
*- yani integerda decimal emas boshqalar qollaniladi: -2,147,483,648 va 2,147,483,647.
Integer hech bolmaganda bitta raqamdan tashil topishi.Decimal bolmasligi.
Yuqoridagi namunada "$x" bu integer, PHP var_dump(); funksiya integerga qaytish uchun.
PHP Float namuna:
PHP Boolean namuna:
$x=true;
$y=false:
*- boolean ikkita true(togri) va false(yolgon) dan tashkil topadi.
PHP Array namuna:
*- koryapmizki, bu yerda $cars array, chunki array koplab amallardan iborat.
PHP String function:
Funksiya strlen(); dan iborat, yani string+length=strlen
Bu satrni olchamini, undagi belgilar sonini aniqlaydi va ekranga uzatadi:
Funksiya str_word_count(); bu satrdagi sozlar sonini aniqlaydi:
Funksiya strrev(); bu funksiya tentaklar uchun, yani u sozni teskari qilib beradi:
Funksiya strpos(); bu kerakli sozni satrdan topib beradi, world sozini Hello World dan topamiz:
Funksiya str_replace() string+replace(almashtirish), yani bu tanlangan sozni avvalgi bilan almashtiradi:
Bu yerda world sozi Dollyga almashdi, natija Hello Dolly boldi:
*- hozircha shu.Ertaga yana yozaman
Тупа адихаю
Demak yana davom ettiramiz.
PHP DATA TYPES:
String
Integer
Float (floating point numbers - also called double)
Boolean
Array
Object
NULL
Resource
PHP String namuna:
<?php $x = "Hello world!"; $y = 'Hello world!'; echo $x; echo "<br>"; echo $y; ?>
*- yani matnli ozgaruvchilar, string deb ataladi.
PHP Integer namuna:
<?php $x = 5985; var_dump($x); ?>
*- yani integerda decimal emas boshqalar qollaniladi: -2,147,483,648 va 2,147,483,647.
Integer hech bolmaganda bitta raqamdan tashil topishi.Decimal bolmasligi.
Yuqoridagi namunada "$x" bu integer, PHP var_dump(); funksiya integerga qaytish uchun.
PHP Float namuna:
<?php $x = 10.365; var_dump($x); ?>
PHP Boolean namuna:
$x=true;
$y=false:
*- boolean ikkita true(togri) va false(yolgon) dan tashkil topadi.
PHP Array namuna:
<?php $cars = array("Volvo","BMW","Toyota"); var_dump($cars); ?>
*- koryapmizki, bu yerda $cars array, chunki array koplab amallardan iborat.
PHP String function:
Funksiya strlen(); dan iborat, yani string+length=strlen
Bu satrni olchamini, undagi belgilar sonini aniqlaydi va ekranga uzatadi:
<?php /*bu yerda belgilar 12 ta, sanab koring, Hello=5, probel=1, world!=6*/ echo strlen("Hello world!"); ?>
Funksiya str_word_count(); bu satrdagi sozlar sonini aniqlaydi:
<?php // bu yerda koryapsiz, Hello va World yani 2 ta soz bor echo str_word_count("Hello world!"); ?>
Funksiya strrev(); bu funksiya tentaklar uchun, yani u sozni teskari qilib beradi:
<?php // hosil bolgan soz !dlrow olleH echo strrev("Hello world!"); ?>
Funksiya strpos(); bu kerakli sozni satrdan topib beradi, world sozini Hello World dan topamiz:
<?php // 6 echo strpos("Hello world!", "world"); ?>
Funksiya str_replace() string+replace(almashtirish), yani bu tanlangan sozni avvalgi bilan almashtiradi:
Bu yerda world sozi Dollyga almashdi, natija Hello Dolly boldi:
<?php // Hello Dolly echo str_replace("world", "Dolly", "Hello world!"); ?>
*- hozircha shu.Ertaga yana yozaman
Тупа адихаю