This is my first php program!



Download 6,9 Mb.
Pdf ko'rish
bet18/69
Sana26.02.2022
Hajmi6,9 Mb.
#471647
1   ...   14   15   16   17   18   19   20   21   ...   69
Bog'liq
PHP

Data Types
|
25
PHP recognizes floating-point numbers written in two different formats. There’s the
one we all use every day:
3.14
0.017
-7.1
but PHP also recognizes numbers in scientific notation:
0.314E1 // 0.314*10
1
, or 3.14
17.0E-3 // 17.0*10
-3
, or 0.017
Floating-point values are only approximate representations of numbers. For exam-
ple, on many systems 3.5 is actually represented as 3.4999999999. This means you
must take care to avoid writing code that assumes floating-point numbers are repre-
sented completely accurately, such as directly comparing two floating-point values
using
==
. The normal approach is to compare to several decimal places:
if (int($a * 1000) == int($b * 1000)) {
// numbers equal to three decimal places
Use the
is_float( )
function (or its
is_real( )
alias) to test whether a value is a float-
ing point number:
if (is_float($x)) {
// $x is a floating-point number
}
Strings
Because strings are so common in web applications, PHP includes core-level support
for creating and manipulating strings. A string is a sequence of characters of arbi-
trary length. String literals are delimited by either single or double quotes:
'big dog'
"fat hog"
Variables are expanded within double quotes, while within single quotes they are
not:
$name = "Guido";
echo "Hi, $name\n";
echo 'Hi, $name';
Hi, Guido
Hi, $name
Double quotes also support a variety of string escapes, as listed in Table 2-2.
Table 2-2. Escape sequences in double-quoted strings
Escape sequence
Character represented
\"
Double quotes
\n
Newline
,ch02.15294 Page 25 Wednesday, March 13, 2002 11:42 AM


This is the Title of the Book, eMatter Edition
Copyright © 2002 O’Reilly & Associates, Inc. All rights reserved.

Download 6,9 Mb.

Do'stlaringiz bilan baham:
1   ...   14   15   16   17   18   19   20   21   ...   69




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish