时间:2021-08-11 08:23:53 | 栏目:JavaScript代码 | 点击:次
1.JAVASCRIPT:
a. 代码:
var a = function(){ } var my_a = new a() my_a.say = function(){ console.log('hello') } my_a.say()
b. 输出:
hello
2. PHP:
a. 代码:
<?php class a{ } $a = new a(); $a->say = function(){ echo "hello"; }; $say = $a->say; $say();
b. 输出:
hello