one day php. alomost all;
<?
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;的更多相关文章
- [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 ...
随机推荐
- java基础——快速排序
今天又把以前学的快速排序拿出来回忆一下 高快省的排序算法 有没有既不浪费空间又可以快一点的排序算法呢?那就是“快速排序”啦!光听这个名字是不是就觉得很高端呢. 假设我们现在对“6 1 2 7 9 3 ...
- [译]The Python Tutorial#8. Errors and Exceptions
[译]The Python Tutorial#Errors and Exceptions 到现在为止都没有过多介绍错误信息,但是已经在一些示例中使用过错误信息.Python至少有两种类型的错误:语法错 ...
- 集群环境(session多服务器共享的方案梳理)
目前业界解决session共享的几种思路,我总结如下: 第一种办法:把原来存储在服务器磁盘上的session数据存储到客户端的cookie中去. 这样子,就不需要涉及到数据共享了.a客户端请求的时候, ...
- JAVA基础篇—继承
父类Vehicle package com.car; public class Vehicle { final String brand;// String color;// double speed ...
- cpu位图
SMP处理器中要用到cpu位图,用来维护系统内CPU的状态信息,具有代表性的有: cpu_possible_map.cpu_online_map.cpu_present_map. static DEC ...
- phpMyAdmin关于PHP 5.5+ is required. Currently installed version is: 5.4.16问题
出现这个提示PHP 5.5+ is required. Currently installed version is: 5.4.16原因可能是: phpmyadmin 版本太新,最小需要php5.5. ...
- Tourists Gym - 101002I LCA——dfs+RMQ在线算法
LCA(Least Common Ancestors),即最近公共祖先,是指这样一个问题:在有根树中,找出某两个结点u和v最近的公共祖先(另一种说法,离树根最远的公共祖先). 知识需求:1)RMQ的S ...
- Page-Object思想
为什么要使用page-object 集中管理元素对象 集中管理一个page内的公共方法 后期维护方便 集中管理元素对象 实现方法: 调用方法: WebElement element = dri ...
- python字符串、列表和字典的说明
python字符串.列表和字典的说明 字符串.列表.字典 字符串的作用存储一段数据信息.例如 info = '我爱北京天安门' ,在调取的时候可以直接调取,灵活方便,print(info) 就可以把刚 ...
- java append方法
JAVA 中 Stringbuffer 有append()方法 Stringbuffer其实是动态字符串数组 append()是往动态字符串数组添加,跟“xxxx”+“yyyy”相当那个‘+’号 ...