�����»������

����Ŀ¼
��
Expressions
IF
ELSE
ELSEIF
WHILE
DO..WHILE
FOR
SWITCH
REQUIRE
INCLUDE
FUNCTION
OLD_FUNCTION
CLASS

�κ�PHP 3 script��������һϵ�е���乹�ɡ�һ���������Ǹ�ֵ���������ã�һ��ѭ��,һ��������䣬����û���κ����ݣ�������䣩��ÿ������ԷֺŽ���������,������{}���Ž�һϵ�����д��һ��������䡣���½����������䡣

����ʽ

����ʽ��PHP����Ҫ�����Ԫ�ء���PHP 3.0��,��������д ���κζ������DZ���ʽ������ʽ����򵥵���ȷ�Ķ�����"��һ��ֵ���κζ���"��

�򵥵������dz����ͱ���������д "$a = 5"ʱ, ��� $a ����ֵ '5' �� '5', ��Ȼֵ�� 5,���߻���֮�� һ��ֵΪ '5'�ı���ʽ(�����������, '5' ��һ�����γ���)���ڴˣ�����ϣ���� $a ��ֵ�� 5������д $b = $a ʱ,��ϣ���Ľ������ $b = 5 ���� $a ��һ��ֵΪ 5 �ı���ʽ��

���ӱ���ʽ�ļ������Ǻ���������˵���������º���:

      function foo()
      {
          return 5;
      }
     

�������Ϊд$c = foo()ʵ���Ϻ�д $c = 5,��ô���ǶԵģ��ܸ�������Ϥ�����ĸ���(����㲻��Ϥ����һ����������)��������ֵΪ�䷵��ֵ�ı���ʽ����Ϊfoo() ����5, ���Ա���ʽ 'foo()'��ֵ�� 5 ��ͨ����������������һ���̶���ֵ��Ҫ��ijЩ���㡣

PHP��ֵ��Ȼ����������,��ͨ�������ǡ�PHP֧�� 3 ��ֵ������: ����ֵ,����ֵ���ַ���ֵ(����ֵ�Dz����ٷֵ�ֵ, ���粻ͬ������)��PHP ֧�����ֻ������(non-scalar): ����Ͷ������������͵�ֵEach of ���Ը�ֵ��������Ӻ����з��ء�

������Ϊֹ��PHP/FI 2���û�û�ио��κα仯��PHP 3 ����������һ���DZ���ʽions ��Զ��PHP 3��һ���������ʽ������, ���Լ������ж������DZ���ʽ�����������Ѿ����۵�����, '$a = 5'�������׿�������������ֵ,���γ��� '5'��ֵ,��Ҳ����Ϊ 5 �ı��� $a ��ֵ����������ʵ���ϻ���һ�����ӵ�ֵ,���Ǹ�ֵ��䱾����ֵ����ֵ��䱾����ֵ���DZ�������ֵ���������� 5. ��ʵ�ϣ�����ζ�Ų����� '$a = 5'Ҫ��ʲô,����һ��ֵΪ 5 �ı���ʽ��������д���� '$b = ($a = 5)'����䣬���� '$a = 5; $b = 5;' (ÿ�����ĩβ��һ���ֺ�)����Ϊ��ֵ��˳���Ǵ����������Ҳ����д�� '$b = $a = 5'��

����ʽ���㷽�����һ���������� �ȼӡ���Ӽ��ȼ��������PHP/FI�Ͷ����������Ե��û����ܺ���Ϥ variable++ �� variable--�������ԼӺ��Լ����������� PHP/FI 2 ��,��� '$a++' û��ֵ(�����DZ���ʽ), ������ͼȲ��ܸ�ֵ����Ҳ����ͨ���κΰ취ʹ������PHP 3 �����DZ���˺� C ��һ���ı���ʽ�Ӷ���ǿ���ԼӺ��Լ�������������� C �����ƣ�PHP 3��Ҳ���������͵��Լ�----�ȼӺͺ�ӡ��ȼӺͺ�ӵı��ʶ��DZ����Լӣ����ڱ���������������һ���ġ���ͬ�����Լӱ���ʽ��ֵ������ '++$variable'���ȼ�, ��������ԼӺ��ֵ(PHP���������Լӣ��ٶ�ȡ����ֵ��Ҳ�ͽ��� '�ȼ�').����'$variable++'�ĺ��, ���ȼ���ԭʼ����$variable��ֵ��Ȼ��Ž����Լ� (PHP�ڶ�ȡ������ֵ�������Լ�,��˽���'���').

����ı���ʽ�DZȽϱ���ʽ�����ֱ���ʽ�������� 0 �� 1,�ֱ���ζ�� FALSE ���� TRUE�� PHP ֧�� > (����), >= (���ڵ���), == (����), < (С��) �� <= (С�ڵ���)�����ֱ���ʽͨ����������ִ���� , ����  IF ��䡣

�������������Ҫ���۵ı���ʽ�ǻ�ϸ�ֵ����ʽ�����Ѿ�֪�����Ҫʹ $a ��һ,����Լ򵥵�дһ��  '$a++' ���� '++$a'���������Ҫ���ӵ�ֵ��1����ô���أ�����ʹ���� 3 ? ����Զ�д����'$a++' ������ ��Ȼ����һ�ָ�Ч���������ڽ��ܵİ취������һ��ͨ���İ취��д '$a = $a + 3'���ȼ���'$a + 3' ��ֵ���ڸ��ص� $a, ���� $a �ͼ���  3 �ˡ���PHP 3 ��,��������������������ԣ����� C��һ��������д������������������׶��� �ѵ�ǰ���� $a �� 3 ����д�� '$a += 3'����仰����˼�� "ȡ�� $a ��ֵ, ������ 3 , �ڸ��� $a"�������ʹ������̡�����,��ʹ��ִ�еĸ��졣����ʽ '$a += 3'��ֵ,��һ���ϸ�ĸ�ֵ���һ������������ֵ��ע�⣺���� 3, ���� $a �� 3 ��ֵ(����Ǹ���$a ��)���κε�˫������ ���Ա��������ָ�ֵ����ģʽ,���� '$a -= 5' (���� $a ��ȥ 5 ), '$b *= 7' ( ���� $b ���� 7),�ȵȡ�

�������Ӱ�����õ������ȼӺͺ�ӣ�

function double($i)
{
	return $i*2;
}
$b = $a = 5;        /* assign the value five into the variable $a and $b */
$c = $a++;          /* post-increment, assign original value of $a (5) to $c */
$e = $d = ++$b;     /* pre-increment, assign the incremented value of $b (6) to $d and $e */
/* at this point, both $d and $e are equal to 6 */
$f = double($d++);  /* assign twice the value of $d before the increment, 2*6 = 12 to $f */
$g = double($++e);  /* assign twice the value of $e after the increment, 2*7 = 14 to $f */
$h = $g += 10;      /* first, $g is incremented by 10 and ends with the value of 24.
                       the value of the assignment (24) is then assigned into $h,
                       and $h ends with the value of 24 as well. */

�ڱ��¿�ʼʱ����˵�����ǽ���������������,���չ涨������ʽ��������䡣���������еı���ʽ������䡣�������������һ������ 'expr' ';'����䣬Ҳ����һ������ʽ���һ���ֺš��� '$b=$a=5;' ��, $a=5 ��һ���Ϸ��ı���ʽ,�����Լ�����һ����䡣������ '$b=$a=5;' ��һ���Ϸ�����䡣

���ֵ���ᵽ���DZ���ʽ����ֵ���ܶ�ʱ����Ҫ��������ִ�к�ѭ��ʱ�����㲢�����ı���ʽ���ض�ֵ , ��ֻ��ע��������TRUE ���� FALSE (PHP û��ר�õIJ�������)��PHP��ʹ������perl�ķ����������ʽ����ֵ���κη����ֵΪ TRUE,��Ϊ FALSE ����һ��ע�⸺���ֵ�Ƿ���ֵ��������Ϊ TRUE ! ���ַ����� �ַ��� "0" Ϊ FALSE; ���������ַ���Ϊ TRUE �����ڷ�����ֵ(����Ͷ���) - �������ֵ�����κ�Ԫ��Ϊ FALSE, ����Ϊ TRUE��

PHP 3 �ṩ��������ǿ��ı���ʽʵ�֣����ڱ��ֲ��и���������˵�����������ӽ̸���ʲô�DZ���ʽ�������������õı���ʽ��Throughout ���ֲ��ʣ�ಿ�֣����ǽ��������Ϸ��ı���ʽ������'expr'��