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. 1036 Boys vs Girls (25)(25 point(s))

    problem This time you are asked to tell the difference between the lowest grade of all the male stud ...

  2. PHP 笔记——自定义函数

    1. 定义函数 function function_name ([$arg_1],[$arg_2], ... [$arg_n]){ fun_body; [return arg_n;] } 在PHP中, ...

  3. 2809: [Apio2012]dispatching 可并堆 左偏树

    https://www.lydsy.com/JudgeOnline/problem.php?id=2809 板子题wa了一下因为输出ans没有lld #include<iostream> ...

  4. [UOJ422]小Z的礼物

    设要取的物品集合为$S$,$E=n(m-1)+(n-1)m$,$x_T$为覆盖了$T$中至少一个元素的$1\times2$数量 $$\begin{aligned}\sum\limits_{i=1}^\ ...

  5. 汇编代码中db,dw,dd的区别

    db定义字节类型变量,一个字节数据占1个字节单元,读完一个,偏移量加1 dw定义字类型变量,一个字数据占2个字节单元,读完一个,偏移量加2 dd定义双字类型变量,一个双字数据占4个字节单元,读完一个, ...

  6. Codeforces Round #359 (Div. 2) B. Little Robber Girl's Zoo 水题

    B. Little Robber Girl's Zoo 题目连接: http://www.codeforces.com/contest/686/problem/B Description Little ...

  7. PIVOT函数与UNPIVOT函数的运用

    PIVOT用于将行转为列,完整语法如下: TABLE_SOURCE PIVOT( 聚合函数(value_column) FOR pivot_column IN(<column_list>) ...

  8. 理解linux下源码、yum和rpm安装方法的特点

    1.yum可看作在线安装,只需yum install 软件名,系统就自动根据yum源配置文件中的镜像位置去下载安装包,并可以自动分析所需的软件依赖关系,自动安装所需的依赖软件包.简单方便,不易出错,不 ...

  9. CentOS的update-grub2命令

    这个和Ubuntu还是有些区别,在CentOS修改成如下: grub2-mkconfig -o /boot/grub2/grub.cfg

  10. 借助LVS+Keepalived实现负载均衡

    原文地址:http://www.cnblogs.com/edisonchou/p/4281978.html 一.负载均衡:必不可少的基础手段 1.1 找更多的牛来拉车吧 当前大多数的互联网系统都使用了 ...