欢迎您访问我爱IT技术网,今天小编为你分享的编程技术是:【为您详解PHP开发工具的使用与分析】,下面是详细的分享!
为您详解PHP开发工具的使用与分析
<?php
// the test is the following
function println($s=""){
print "$s<br>\n";
}
class GetSetTest
{
var $var=null;
function setByRef(&$arg){
$this->var=& $arg;
}
function passByRef(&$arg){
$this->var=$arg;
}
function setByVal($arg){
$this->var=$arg;
}
function &getByRef(){
return $this->var;
}
function getByVal(){
return $this->var;
}
}
$o=new GetSetTest;
println("============setByRef getByRef=============");
println("-----------------Before change----------------");
$in="before change";
$o->setByRef($in);
$outByVal=$o->getByRef();
$outByRef=& $o->getByRef();
println("\$in: ".$in);
println("\$outByVal: ".$outByVal);
println("\$outByRef: ".$outByRef);
println("\$this->var: ".$o->var);
println("-----------------After change-----------------");
$in="after change";
println("\$in: ".$in);
println("\$outByVal: ".$outByVal);
println("\$outByRef: ".$outByRef);
println("\$this->var: ".$o->var);
println();
println("============setByRef getByVal=============");
println("-----------------Before change----------------");
$in="before change";
$o->setByRef($in);
$outByVal=$o->getByVal();
$outByRef=& $o->getByVal();
println("\$in: ".$in);
println("\$outByVal: ".$outByVal);
println("\$outByRef: ".$outByRef);
println("\$this->var: ".$o->var);
println("-----------------After change-----------------");
$in="after change";
println("\$in: ".$in);
println("\$outByVal: ".$outByVal);
println("\$outByRef: ".$outByRef);
println("\$this->var: ".$o->var);
println();
println("============passByRef getByVal=============");
println("-----------------Before change----------------");
$in="before change";
$o->passByRef($in);
$outByVal=$o->getByVal();
$outByRef=& $o->getByVal();
println("\$in: ".$in);
println("\$outByVal: ".$outByVal);
println("\$outByRef: ".$outByRef);
println("\$this->var: ".$o->var);
println("-----------------After change-----------------");
$in="after change";
println("\$in: ".$in);
println("\$outByVal: ".$outByVal);
println("\$outByRef: ".$outByRef);
println("\$this->var: ".$o->var);
println();
?>
以上所分享的是关于为您详解PHP开发工具的使用与分析,下面是编辑为你推荐的有价值的用户互动:
相关问题:请推荐新手PHP开发环境和工具
答:一键搭建php环境(适合小白用户)教程,纯手工打造!记得采纳啊,亲 http://host.zzidc.com/wljc/1099.html >>详细
相关问题:PHP 开发工具是哪个?请高手指点,谢谢!
答:zend editplus nod++ phpstorm >>详细
相关问题:我想学习PHP语言,请问使用什么开发工具最好。
答:zend studio 是php开发中最好最强的IDE >>详细
- 评论列表(网友评论仅供网友表达个人看法,并不表明本站同意其观点或证实其描述)
-
