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. web服务端安全之文件上传漏洞

    一.文件上传漏洞的原理 由于程序代码未对用户提交的文件进行严格的分析和检查,导致攻击者可以上传可执行的代码文件,从而获取web应用的控制权限. 常见于上传功能,富文本编辑器. 二.文件上传漏洞的防御 ...

  2. 【10.10校内测试】【线段树维护第k小+删除】【lca+主席树维护前驱后驱】

    贪心思想.将a排序后,对于每一个a,找到对应的删除m个后最小的b,每次更新答案即可. 如何删除才是合法并且最优的?首先,对于排了序的a,第$i$个那么之前就应该删除前$i-1$个a对应的b.剩下$m- ...

  3. Minimum Size Subarray Sum 最短子数组之和

    题意 Given an array of n positive integers and a positive integer s, find the minimal length of a suba ...

  4. vue各生命周期适合做的业务逻辑

    一.实际项目中使用最多的Vue生命周期大概是  created  mounted  updated 二.各自适合做的业务逻辑 1. created   相当于是页面刚开始加载的状态,此时不能操作实例的 ...

  5. 关闭IE8的首次运行自定义设置

    方法一:顺着IE8的提示,一步一步的了解看完或设置完等的,它“推荐”的你应该做的事,然后重新设置首页就行了. 方法二:开始->运行->输入:gpedit.msc->用户配置-> ...

  6. Polly简介 — 1. 故障处理策略

    Polly 是 .Net 下的一套瞬时故障处理及恢复的函式库,可让开发者以fluent及线程安全的方式来应用诸如Retry.Circuit Breaker.Timeout.Bulkhead Isola ...

  7. BZOJ 1500: [NOI2005]维修数列 (splay tree)

    1500: [NOI2005]维修数列 Time Limit: 10 Sec  Memory Limit: 64 MBSubmit: 4229  Solved: 1283[Submit][Status ...

  8. C#线程安全的那些事

    还是上一次,面试的时候提到了C#线程安全的问题,当时回答的记不太清了,大概就是多线程同是调用某一个函数时可能会照成数据发生混乱,运行到最后发现产生的结果或数据并不是自己想要的,或是跨线程调用属性或方法 ...

  9. git diff 打补丁

    [root@workstation2017 demo]# git diff old new >cc.diff[root@workstation2017 demo]# cat cc.diffdif ...

  10. 如何在windows server 2008上配置NLB群集

    参考:http://zlwdouhao.blog.51cto.com/731028/781828 前些天写了一篇关于NLB群集模式多播和单播的简单介绍.那么下面我们一起来探讨一下,如何在windows ...