note 43879 deleted from function.compact by tomsommer
| From: | tomsommer@php.net | Date: | Wed, 07 Jul 2004 07:13:28 +0000 |
| Subject: | note 43879 deleted from function.compact by tomsommer | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-72812@lists.php.net to get a copy of this message | ||
Note Submitter: ycs523@chol.com
----
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