This is my first php program!



Download 6,9 Mb.
Pdf ko'rish
bet37/69
Sana26.02.2022
Hajmi6,9 Mb.
#471647
1   ...   33   34   35   36   37   38   39   40   ...   69
Bog'liq
PHP

Array
(
[name] => Fred
[age] => 35
)
You can cast an array to an object to build an object whose properties correspond to
the array’s keys and values. For example:
$a = array('name' => 'Fred', 'age' => 35, 'wife' => 'Wilma');
$o = (object) $a;
echo $o->name;
Fred
Keys that aren’t valid identifiers, and thus are invalid property names, are inaccessi-
ble but are restored when the object is cast back to an array.
Assignment Operators
Assignment operators store or update values in variables. The autoincrement and
autodecrement operators we saw earlier are highly specialized assignment opera-
tors—here we see the more general forms. The basic assignment operator is
=
, but
we’ll also see combinations of assignment and binary operations, such as
+=
and
&=
.
Assignment
The basic assignment operator (
=
) assigns a value to a variable. The lefthand oper-
and is always a variable. The righthand operand can be any expression—any simple
literal, variable, or complex expression. The righthand operand’s value is stored in
the variable named by the lefthand operand.
,ch02.15294 Page 44 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.
Expressions and Operators
|
45
Because all operators are required to return a value, the assignment operator returns
the value assigned to the variable. For example, the expression
$a = 5
not only assigns
5
to
$a
, but also behaves as the value
5
if used in a larger expression. Consider the
following expressions:
$a = 5;
$b = 10;
$c = ($a = $b);
The expression
$a = $b
is evaluated first, because of the parentheses. Now, both
$a
and
$b
have the same value,
10
. Finally,
$c
is assigned the result of the expression
$a = $b
,
which is the value assigned to the lefthand operand (in this case,
$a
). When the full
expression is done evaluating, all three variables contain the same value,
10
.

Download 6,9 Mb.

Do'stlaringiz bilan baham:
1   ...   33   34   35   36   37   38   39   40   ...   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