¾È³çÇϽʴϱî? HappyCGIÆÀ¿¡ whiteÀÔ´Ï´Ù.
><? >function a($a, $b) { >$temp = $a; >$a = $b; >$b = $temp; >} >a(1,3); >echo($a."--".$b); >?> >ÀÌ ¼Ò½º¿¡¼¿ä $a $b¿¡ °ªÀÌ Á¸Àç ÇÒ¼ö ÀÖ³ª¿ä? >aÇÔ¼ö¿¡¼ ¼±¾ðµÈ $a, $b, $temp¸¦ >ÇÔ¼ö¹Û¿¡ ¼µµ ¾µ¼ö ÀÖ³ª¿ä? >
function ¾È¿¡¼ Á¤ÀÇ µÈ º¯¼ö´Â ¹Û¿¡¼ Àû¿ëµÇÁö ¾Ê½À´Ï´Ù. ÇÔ¼ö ¹Û¿¡¼µµ µ¿ÀÏÇÏ°Ô Àû¿ëÇÒ·Á¸é ÇÔ¼ö ³»¿¡¼ º¯¼ö¸¦ global ·Î Á¤ÀÇÇØ ÁÖ¸é µË´Ï´Ù. ´ÔÀÇ ¼Ò½ºÀÇ °æ¿ì function a($a, $b) {
global $temp,$a,$b;
$temp = $a; $a = $b; $b = $temp; } ÀÌ·¸°Ô ÇÏ½Ã¸é µÇ°Ú½À´Ï´Ù.
°¨»çÇÕ´Ï´Ù. ÁÁÀº ÇÏ·ç µÇ¼¼¿ä.^^
|