php中实现事件模式

https://yq.aliyun.com/ziliao/162660

<?php

class Event{

    private $events = [];

    public function listen($name, $callback){
if(!key_exists($name, $this->events))
$this->events[$name] = $callback;
} public function trigger($name){
if(key_exists($name, $this->events)){
call_user_func($name);
}
} } $eventManager = new Event();
function go(){
echo "go event happen!";
}
$eventManager->listen('go', 'go');
//$eventManager->trigger('go');
var_dump(get_defined_functions());

  

------------------------------------------------------

D:\wnmp\www\vidagrid_iot\app\webroot\event.php:27:

array (size=2)
'internal' =>
array (size=1355)
0 =>

string

 'zend_version' (length=12)
1 =>

string

 'func_num_args' (length=13)
2 =>

string

 'func_get_arg' (length=12)
3 =>

string

 'func_get_args' (length=13)
4 =>

string

 'strlen' (length=6)
5 =>

string

 'strcmp' (length=6)
6 =>

string

 'strncmp' (length=7)
7 =>

string

 'strcasecmp' (length=10)
8 =>

string

 'strncasecmp' (length=11)
9 =>

string

 'each' (length=4)
10 =>

string

 'error_reporting' (length=15)
11 =>

string

 'define' (length=6)
12 =>

string

 'defined' (length=7)
13 =>

string

 'get_class' (length=9)
14 =>

string

 'get_called_class' (length=16)
15 =>

string

 'get_parent_class' (length=16)
16 =>

string

 'method_exists' (length=13)
17 =>

string

 'property_exists' (length=15)
18 =>

string

 'class_exists' (length=12)
19 =>

string

 'interface_exists' (length=16)
20 =>

string

 'trait_exists' (length=12)
21 =>

string

 'function_exists' (length=15)
22 =>

string

 'class_alias' (length=11)
23 =>

string

 'get_included_files' (length=18)
24 =>

string

 'get_required_files' (length=18)
25 =>

string

 'is_subclass_of' (length=14)
26 =>

string

 'is_a' (length=4)
27 =>

string

 'get_class_vars' (length=14)
28 =>

string

 'get_object_vars' (length=15)
29 =>

string

 'get_class_methods' (length=17)
30 =>

string

 'trigger_error' (length=13)
31 =>

string

 'user_error' (length=10)
32 =>

string

 'set_error_handler' (length=17)
33 =>

string

 'restore_error_handler' (length=21)
34 =>

string

 'set_exception_handler' (length=21)
35 =>

string

 'restore_exception_handler' (length=25)
36 =>

string

 'get_declared_classes' (length=20)
37 =>

string

 'get_declared_traits' (length=19)
38 =>

string

 'get_declared_interfaces' (length=23)
39 =>

string

 'get_defined_functions' (length=21)
40 =>

string

 'get_defined_vars' (length=16)
41 =>

string

 'create_function' (length=15)
42 =>

string

 'get_resource_type' (length=17)
43 =>

string

 'get_loaded_extensions' (length=21)
44 =>

string

 'extension_loaded' (length=16)
45 =>

string

 'get_extension_funcs' (length=19)
46 =>

string

 'get_defined_constants' (length=21)
47 =>

string

 'debug_backtrace' (length=15)
48 =>

string

 'debug_print_backtrace' (length=21)
49 =>

string

 'gc_collect_cycles' (length=17)
50 =>

string

 'gc_enabled' (length=10)
51 =>

string

 'gc_enable' (length=9)
52 =>

string

 'gc_disable' (length=10)
53 =>

string

 'bcadd' (length=5)
54 =>

string

 'bcsub' (length=5)
55 =>

string

 'bcmul' (length=5)
56 =>

string

 'bcdiv' (length=5)
57 =>

string

 'bcmod' (length=5)
58 =>

string

 'bcpow' (length=5)
59 =>

string

 'bcsqrt' (length=6)
60 =>

string

 'bcscale' (length=7)
61 =>

string

 'bccomp' (length=6)
62 =>

string

 'bcpowmod' (length=8)
63 =>

string

 'jdtogregorian' (length=13)
64 =>

string

 'gregoriantojd' (length=13)
65 =>

string

 'jdtojulian' (length=10)
66 =>

string

 'juliantojd' (length=10)
67 =>

string

 'jdtojewish' (length=10)
68 =>

string

 'jewishtojd' (length=10)
69 =>

string

 'jdtofrench' (length=10)
70 =>

string

 'frenchtojd' (length=10)
71 =>

string

 'jddayofweek' (length=11)
72 =>

string

 'jdmonthname' (length=11)
73 =>

string

 'easter_date' (length=11)
74 =>

string

 'easter_days' (length=11)
75 =>

string

 'unixtojd' (length=8)
76 =>

string

 'jdtounix' (length=8)
77 =>

string

 'cal_to_jd' (length=9)
78 =>

string

 'cal_from_jd' (length=11)
79 =>

string

 'cal_days_in_month' (length=17)
80 =>

string

 'cal_info' (length=8)
81 =>

string

 'ctype_alnum' (length=11)
82 =>

string

 'ctype_alpha' (length=11)
83 =>

string

 'ctype_cntrl' (length=11)
84 =>

string

 'ctype_digit' (length=11)
85 =>

string

 'ctype_lower' (length=11)
86 =>

string

 'ctype_graph' (length=11)
87 =>

string

 'ctype_print' (length=11)
88 =>

string

 'ctype_punct' (length=11)
89 =>

string

 'ctype_space' (length=11)
90 =>

string

 'ctype_upper' (length=11)
91 =>

string

 'ctype_xdigit' (length=12)
92 =>

string

 'strtotime' (length=9)
93 =>

string

 'date' (length=4)
94 =>

string

 'idate' (length=5)
95 =>

string

 'gmdate' (length=6)
96 =>

string

 'mktime' (length=6)
97 =>

string

 'gmmktime' (length=8)
98 =>

string

 'checkdate' (length=9)
99 =>

string

 'strftime' (length=8)
100 =>

string

 'gmstrftime' (length=10)
101 =>

string

 'time' (length=4)
102 =>

string

 'localtime' (length=9)
103 =>

string

 'getdate' (length=7)
104 =>

string

 'date_create' (length=11)
105 =>

string

 'date_create_immutable' (length=21)
106 =>

string

 'date_create_from_format' (length=23)
107 =>

string

 'date_create_immutable_from_format' (length=33)
108 =>

string

 'date_parse' (length=10)
109 =>

string

 'date_parse_from_format' (length=22)
110 =>

string

 'date_get_last_errors' (length=20)
111 =>

string

 'date_format' (length=11)
112 =>

string

 'date_modify' (length=11)
113 =>

string

 'date_add' (length=8)
114 =>

string

 'date_sub' (length=8)
115 =>

string

 'date_timezone_get' (length=17)
116 =>

string

 'date_timezone_set' (length=17)
117 =>

string

 'date_offset_get' (length=15)
118 =>

string

 'date_diff' (length=9)
119 =>

string

 'date_time_set' (length=13)
120 =>

string

 'date_date_set' (length=13)
121 =>

string

 'date_isodate_set' (length=16)
122 =>

string

 'date_timestamp_set' (length=18)
123 =>

string

 'date_timestamp_get' (length=18)
124 =>

string

 'timezone_open' (length=13)
125 =>

string

 'timezone_name_get' (length=17)
126 =>

string

 'timezone_name_from_abbr' (length=23)
127 =>

string

 'timezone_offset_get' (length=19)

php中120个内置函数的更多相关文章

  1. JS中的日期内置函数

    用JS中的日期内置函数实现在页面显示:“今天是:2013年9月26日14:32:45”. var date=new Date(Date.parse('9/26/2013 14:32:45'));   ...

  2. 洗礼灵魂,修炼python(4)--从简单案列中揭示常用内置函数以及数据类型

    上一篇说到print语句,print是可以打印任何类型到屏幕上,都有哪些类型呢? 整形(int) 长整型(long) 浮点型(float) 字符型(str) 布尔型(bool) 最常见的就这几种. 在 ...

  3. 【Python】从简单案列中揭示常用内置函数以及数据类型

    前面提到了BIF(内置函数)这个概念,什么是内置函数,就是python已经定义好的函数,不需要人为再自己定义,直接拿来就可以用的函数,那么都有哪些BIF呢? 可以在交互式界面(IDLE)输入这段代码, ...

  4. python中68个内置函数的总结

    内置函数 内置函数就是python给你提供的, 拿来直接用的函数, 比如print., input等. 截止到python版本3.6.2 python一共提供了68个内置函数. #68个内置函数 # ...

  5. python中常见的内置函数

    map #自定义map函数 def map_test(func, list): res = [] for item in list: res.append(func(item)) return res ...

  6. python中的 dir()内置函数的作用以及使用方法

    dir() 内置函数的作用 python 内置方法有很多,无论是初学者还是精通python 的程序员都不能全部即住所有的方法,这时候 dir() 方法就非常有用了,使用 dir()函数可以查看对象内的 ...

  7. Python中练习题关于内置函数的getattr,setattr问题

    执行一下代码的结果是? class A: def __init__(self,a,b,c): self.x = a+b+c a = A(1,2,3) b = getattr(a,'x') setatt ...

  8. 关于 zend studio 中有些php 内置函数没有提示,或是有‘小黄色感叹号’

    解决办法: 1.修改项目 .buildpath 文件 <?xml version="1.0" encoding="UTF-8"?> <buil ...

  9. MySQL中的一些内置函数

    mysql> select now(); #获取当前的日期和时间 +---------------------+ | now() | +---------------------+ | -- : ...

随机推荐

  1. android setContentView

    韩梦飞沙  韩亚飞  313134555@qq.com  yue31313  han_meng_fei_sha setContentView  这个 就是 设置内容视图. 装饰视图 DecorView ...

  2. ArrayList,Vector,LinkedList

    韩梦飞沙  韩亚飞  313134555@qq.com  yue31313  han_meng_fei_sha 数组列表 和 向量Vector, 都是使用数组方式存储. 向量 使用了 同步synchr ...

  3. 4040 EZ系列之奖金

    4040 EZ系列之奖金 时间限制: 1 s 空间限制: 64000 KB 题目等级 : 钻石 Diamond   题目描述 Description 由于无敌的WRN在2015年世界英俊帅气男总决选中 ...

  4. zookeeper【1】配置管理

    为什么要用统一配置? 我们做项目时用到的配置比如数据库配置等...我们都是写死在项目里面,如果需要更改,那么也是的修改配置文件然后再投产上去,那么问题来了,如果做集群的呢,有100台机器,这时候做修改 ...

  5. 读书笔记_Effective_C++_条款三十九:明智而审慎地使用private继承

    private继承的意义在于“be implemented in turns of”,这个与上一条款中说的复合模型的第二层含义是相同的,这也意味着通常我们可以在这两种设计方法之间转换,但书上还是更提倡 ...

  6. Redis在Windows+linux平台下的安装配置(转)

    window平台Redis安装 下载地址: http://code.google.com/p/servicestack/wiki/RedisWindowsDownload Redis文件夹有以下几个文 ...

  7. ASK,OOK,FSK,GFSK是什么

    http://www.21say.com/askookfskgfsk%E6%98%AF%E4%BB%80%E4%B9%88/ ASK是幅移键控调制的简写,例如二进制的,把二进制符号0和1分别用不同的幅 ...

  8. SQL 脚本中的全角逗号引起【ORA-01756: 引号内的字符串没有正确结束】

    今天运行壹個小程序,功能是读取指定目录下的 SQL 脚本,并加载到内存中批量执行,之前的程序运行良好.但是今天相关开发人员更新了其中壹個 SQL 脚本,于是程序运行的时候就出错了,错误提示信息如下:批 ...

  9. redhat 6.6 安装 (LVM)

    http://www.cnblogs.com/kerrycode/p/4341960.html

  10. inux下查看.so和可执行文件是否debug编译的方法

    命令 readelf -S libxxx.so |grep debug   如果有打印信息就是debug,否则是release.