note 43879 added to function.compact

From: Date: Wed, 07 Jul 2004 06:06:05 +0000
Subject: note 43879 added to function.compact
Groups: php.notes 
Request: Send a blank email to php-notes+get-72810@lists.php.net to get a copy of this message
If you want convert variable to array Like this ±ÔĢȭµÈ º¯¼ö¸¦ ¹è¿­·Î ¸¸µé°íÀÚ ÇÒ¶§.. $a_1 $a_2 $a_3 ´ÙÀ½°ú °°ÀÌ ·çÇÁ¸¦ µ¹¸± ¼ö Àִµ¥¿ä.. for ($i=1;$i<4;$i++) { $string="a_".$i; $out_c=compact($string); } ÀÌ·¸°Ô ÇÏ´Ï compact ÇÔ¼öÀÇ ¹®Á¦ ¶§¹®¿¡ ¿¡·¯°¡ ¹ß»ýÇÕ´Ï´Ù. It has problem with compact function So you must Insert another array µû¶ó¼­ ¾Æ·¡¿Í °°ÀÌ ÇÑ Ç׸ñÀ» »ðÀÔ½ÃÄÑ ÁÖ¾î¾ß ÇÕ´Ï´Ù. for ($i=1;$i<4;$i++) { $string="a_".$i; $out_c=compact($string); $tmp[]=$out_c[$string]; // or $tmp[$string] or $tmp[$i] } I think compact function will delete exist array and make new array.. Its problem is easy but you dont know this problem -_- As my case spend time to find this problem My English is Jurk sorry.. MSN/e-mail : ycs523@chol.com, Kotelman ---- Manual Page -- http://www.php.net/manual/en/function.compact.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+43879 Delete -- http://master.php.net/manage/user-notes.php?action=delete+43879&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+43879&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#72810) next »