<?php
class WebTechnologies
{
private $tech;
// constructor
public function __construct() {
$this->tech = explode( ',', 'PHP,HTML,XHTML,CSS,JavaScript,XML,XSLT,ASP,C#,Ruby,Python') ;
}
}
?>
我想要回显/打印输出:PHP,HTML,XHTML,CSS,JavaScript,xml,xslt,asp,c#,Ruby,Python
如果我必须将$tech更改为私人,请这样做。
顺便说一句,我从这里得到了这个问题 http://www.sitepoint.com/php-simple-object-iterators/
您已经使用 explode
从逗号分隔的字符串构造数组。
现在调查执行相反操作implode
...
嗯。
<?php
echo "PHP,HTML,XHTML,CSS,JavaScript,XML,XSLT,ASP,C#,Ruby,Python";
?>
我错过了什么?