<?
namespace Test;
use \PhpProject\PhpApp as Other;
$u=new Other("ns test");
echo $u->GetUserName();
echo "annotation: use include, pls include \\ which is the common namespace, which need not to be declared as default \\";
echo "<br>";
echo __NAMESPACE__;
echo "<br><br><br><br>";
?>
<?
namespace PhpProject;
//php注释的写法
echo "above shows how to create php annotation<br>";
//php string 连写
$test="inner string";
echo "how are ".$test;
echo "how are:$test<br>";
global $test;
//php类的写法
$GLOBALS["a"]=121;
echo $GLOBALS["a"]."<br>";
class PhpApp{
function PhpApp($name){
$this->self=$name;
$this::__construct($name);
}
//below is alternate way to construct this class
// function __construct(){
// }
public function GetUserName(){
return "how are you ".$this->self;
}
public static $Version;
private $self;
var $pty="pty json";
}
final class WebApp extends PhpApp{
public function GetUserName(){
return "webapp".parent::GetUserName();
}
}
PhpApp::$Version="1.00";
$user=new PhpApp("ctor");
echo $user->GetUserName();
echo PhpApp::$Version;
$web=new WebApp("webapp");
echo $web->GetUserName();
echo json_encode($user,1);
var_dump(json_encode($user));
interface IPhpApp{
function ruin();
}
class MyPhp implements IPhpApp{
function ruin(){
echo "ruined";
}
}
$m=new MyPhp();
$m->ruin();

one day php. alomost all;的更多相关文章

  1. [Webpack 2] Grouping vendor files with the Webpack CommonsChunkPlugin

    Often, you have dependencies which you rarely change. In these cases, you can leverage the CommonsCh ...

随机推荐

  1. Bootstrap历练实例:标签页内的下拉菜单

    <!DOCTYPE html><html><head><meta http-equiv="Content-Type" content=&q ...

  2. 创建自定义 Estimator

    ref 本文档介绍了自定义 Estimator.具体而言,本文档介绍了如何创建自定义 Estimator 来模拟预创建的 Estimator DNNClassifier 在解决鸢尾花问题时的行为.要详 ...

  3. H5 JS判断客户端是否是iOS或者Android手机移动端

    <script type="text/javascript"> var u = navigator.userAgent; || u.indexOf(; //androi ...

  4. python 程序小测试

    python 程序小测试 对之前写的程序做简单的小测试 ... # -*- encoding:utf-8 -*- ''' 对所写程序做简单的测试 @author: bpf ''' def GameOv ...

  5. 批量保存云盘链接的demo

    写在前面的声明: 作为一个正在自学爬虫的小白,用爬虫爬了八千本书的云盘链接,然后就想把这写链接的资源都转存到自己的云盘里,以防某一天资源失效.本来想在网上找个能够批量保存的软件,哪知道找到几个都不能用 ...

  6. 20181206(re,正则表达式,哈希)

    1.re&正则表达式 2.hashlib 一:re模块&正则表达式 正则:正则就是用一些具有特殊含义的符号组合到一起(称为正则表达式)来描述字符或者字符串的方法.或者说:正则就是用来描 ...

  7. perl-basic-数据类型&引用

    我觉得这一系列的标题应该是:PERL,从入门到放弃 USE IT OR U WILL LOSE IT 参考资料: https://qntm.org/files/perl/perl.html 在线per ...

  8. eclipse使用技巧的网站收集——转载(三)

    本文来自:https://www.cnblogs.com/jeffen/p/5965227.html,未经更改,尊重作者 工欲善其事,必先利其器.对于程序员来说,Eclipse便是其中的一个“器”.本 ...

  9. 同一条sql在mysql5.6和5.7版本遇到的问题。

    之前用的是mysql 5.6版本,执行select * from table group by colunm 是可以出结果的, 但是切换的5.7版本,这条sql就报错, Expression #1 o ...

  10. Linux学习-systemctl 针对 service 类型的配置文件

    systemctl 配置文件相关目录简介 现在我们知道服务的管理是透过 systemd,而 systemd 的配置文件大部分放置于 /usr/lib/systemd/system/ 目录内. 该目录的 ...