作者knives ()
看板PHP
標題Re: [請益] 雙錢字號$$的意思?
時間Thu May 20 13:51:17 2010
那如果我想去呼叫一個物件叫 TEST
一般來說我會這樣呼叫 $obj = new TEST();
可是如果我用動態變數的方式的話
$afile = 'test';
$obj = new {strtoupper($afile)}();
可是這樣都不會過
請問這個要怎麼寫才行阿
謝謝
※ 引述《uismuu (烏斯木)》之銘言:
: 一段程式碼
: for($i=4;$i<=5;$i++){
: $temp=$Scenario[$i];
: $$temp=0;
: }
: 請問$$temp是什麼意思?
: 謝謝
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 122.117.39.194
※ 編輯: knives 來自: 122.117.39.194 (05/20 13:52)
推 chph:$class_name = strtoupper('test'); 05/20 13:57
→ chph:$t = new $class_name(); 05/20 13:57
→ knives:要分兩段寫才行嗎 05/20 14:07
推 Ronlong:Google: call_user_func 05/25 14:36