配列を含むアドレスの内容を表示するにはどうすればよいですか?
例:
class ConferenceInfo {
var $confID;
var $confName;
var $divisons = array();
/* display an address in HTML */
function display() {
$output = '';
$output .= $this->confID;
$output .= $this->confName;
foreach($this->divisons as $value) { // I know this is incorrect
$output .= $value;
}
$output .= '<br/>';
return $output;
}
}
そしてPHPコード:
$conf = new ConferenceInfo;
$conf->confID = $someValue1;
$conf->confName = $someValue2;
$conf->divisons[] = $someValue3; // this will eventually loop and fill in multiple values
echo $conf->display();
データの例は次のとおりです。
confID = 1<br/>
confName = Eastern<br/>
dvisions = Atlantic, Central, Northeast
期待される出力は次のdisplay()
とおりです。
1EasternAtlanticCentralNortheast