PHPÊý×e»¹ÊDZȽϳ£Óõģ¬ÓÚÊÇÎÒÑо¿ÁËÒ»ÏÂPHPÊý×e¸³Öµ£¬ÔÚÕaÀiÄóoÀ´ºÍ´o¼Ò*ÖÏiһϣ¬Ï£Íu¶Ô´o¼ÒÓÐÓá£
ËuνÊý×e¾ÍÊÇÒ»×e±aÁ¿µÄ¼¯ºÏ±£´aeÔÚ¼ÆËa»uµÄÄÚ´aeÖУ¬ÕaÐ(C)±aÁ¿¿ÉÒÔÊDz»Í¬µÄÀaÐÍ£¬°uÀ¨ÕuÊý£¬²¼¶uÖµ£¬×Öu´®µÈ¡£¿ÉÒÔ˵Êý×e¾ÍÊÇÄÚ´aeÖеÄÒ»¸oСÐ͵ÄÊý¾Ý¿a£¬ËuΪÎÒÃÇÃÎÊÊý¾ÝÌa¹(C)ÁËÒ»¸o¿i½ÝµÄ½Ê½¨D¨D¿ÉÒÔÊ¡³oIO»oÕßÊý¾Ý¿aµÄƵ±ÃÎÊÒÔ´ËÀ´Ìa¸ßÒ»Ð(C)ÐÔÄÜ£¬ËuÒÔ¹ØÓÚÊý×eÖÐÒ»Ð(C)²Ù×÷Ò²ÊǺܶaµÄ¡£
ÔoÑu´´½¨ÔÚPHPÖд´½¨Êý×e£¬Äa¿ÉÒÔʹÓÃÈçϽ*¨£º
½¨Ö®Ò»´´½¨Êý×e£º
<?php
$a="abcd";
print($a[0]." ".$a[1]." ".$a[2]." ".$a[3]." ");
?>
½a¹u£ºa b c d
½¨¶þ£º
<?php
$http=array("www","helpphp","cn");
print($http[0].".".$http[1].".".$http[2]);
?>
֪ʶ˵Ã÷£º
1.ÎÒÃÇͨ¹ýÇ°ÃaeµÄʵÀý¿ÉÒÔ¿´µ½£¬PHPÖÐÊý×eĬÈÏ´Óϱe£¨Ë÷Òý£(C)¿ªÊ¼±eʾ±aÁ¿ÔÚÊý×eÖеÄλÖã¬Ò²¾ÍÊÇ˵ÎÒÃÇ¿ÉÒÔʹÓãº$±aÁ¿Ãu£ÛË÷Òý£ÝµÄÐÎʽ*ÃÎÊÎÒÃÇËu´´½¨µÄÊý×e¡£
2.ÎÒÃÇʹÓÃarray()ÓiÑÔ½a¹¹À´´´½¨Êý¾Ý£¬ÔÚÊý×eÖÐÕaÈç¹uûÓÐÃ÷È*Ö¸¶¨Ï±e£¬Ä¬ÈÏ´Ó0¿ªÊ¼ÍuºoµÝÔoË÷Òý¡£ÎÒÃÇËu´´½¨µÄÊý×eÒѾ±£´aeÔÚÄÚ´aeÖУ¬µ«ÊÇÔÚÊý¾ÝʹÓúo£¬ÎÒÃÇÒª×÷Ò»¶¨µÄÇaÀi£¬ÒÔ±£Ö¤ÄÚ´aeйÂ(C)¡£
ÔoÑuΪPHPÊý×e¸³ÖµÄØ£¿ÈçÏ£º
$My_array=array()£»
$My_array[]=¡±www¡±
$My_array[]=¡±helpphp¡±;
$My_array[]=¡±cn¡±;
ͨ¹ýÒÔÉϽ¨£¬ÎÒ¾ÍΪ±aÁ¿ÀuÓÃarrayÓiÑÔ½a¹¹´´½¨ÁËÒ»¸o¿ÕµÄÊý×e£¬ÔÚºoÃaeµÄÓi¾aÖоÍΪ$My_array¸³Öµ£¬ÔÚÒ»ÉϽÚÖУ¬ÎÒÃÇÖªµÀ£¬Êý×eϱe£¨Ë÷Òý£(C)£¬´Ó0¿ªÊ¼×Ô¶¯µÝÔo£¬Ò²¾ÍÊÇ˵ÈçÏÂÓi¾a½«Êa³ohelpphp.
Print $My_array[1];
Èç¹uÏeÒ»´ÎÈ«²¿Êa³o$My_arrayÔo¿ÉÒÔʹÓÃprint_r($My_array).ÔoÑuÏu»ÙÊý×e»oÕßÊý×eÖеÄÔªËØÒªÍe³ÉÈçÉϵÄÈÎÎñ£¬Ö»ÒªÊ¹ÓÃunset()º¯Êý¼´¿É£¬Ëu¿ÉÒÔɾ³ýÕu¸oÊý×e»oÕßÊý×eÖеÄij¸oÔªËØ£¬ÈçÏ£º
unset($My_array[0];
unset($My_array);
ÐeҪעÒaµÄÊÇ£¬ÔÚɾ³ýÊý×eÔªËغo£¬Ë÷ÒýÖµ»a±£ÁoÔÀ´µÄλÖ㬲¢²»»aÖØе÷ÕuË÷Òý£¬ÄaÖ»ÐeÒªÔÚɾ³ýºo¶Ô±ÈϾͿÉÒÔ¢ÏÖÕa¸oÏÖÏo¡£Ê¹ÓÃvar_dump()¿Éi²e¿´Êý×eÖиuΪÏeϸµÄ¶«Î÷£¬ÈçÏ£º
Var_dump($My_array);
ÒÔÉϾÍÊǽ̴o¼ÒPHPÊý×e¸³Öµ½¨£¬Ï£Íu¶Ô´o¼ÒµÄѧϰÓÐËuÆo*¢¡£