<?php
//$number = range(0,50,10);
//print_r ($number);
//生成一个自增的数组
header("Content-type:text/html;charset=utf-8");
/*
*
* 类/对象
*
__autoload — 尝试加载未定义的类
call_user_method_array — 调用一个用户方法,同时传递参数数组(已废弃)
call_user_method — 对特定对象调用用户方法(已废弃)
class_alias — 为一个类创建别名
class_exists — 检查类是否已定义
get_called_class — 后期静态绑定("Late Static Binding")类的名称
get_class_methods — 返回由类的方法名组成的数组
get_class_vars — 返回由类的默认属性组成的数组
get_class — 返回对象的类名
get_declared_classes — 返回由已定义类的名字所组成的数组
get_declared_interfaces — 返回一个数组包含所有已声明的接口
get_declared_traits — 返回所有已定义的 traits 的数组
get_object_vars — 返回由对象属性组成的关联数组
get_parent_class — 返回对象或类的父类名
interface_exists — 检查接口是否已被定义
is_a — 如果对象属于该类或该类是此对象的父类则返回 TRUE
is_subclass_of — 如果此对象是该类的子类,则返回 TRUE
method_exists — 检查类的方法是否存在
property_exists — 检查对象或类是否具有该属性
trait_exists — 检查指定的 trait 是否存在
*
*/ //function __autoload($classname) {
// $filename = "./". $classname .".php";
// include_once($filename);
//}
//
//// we've called a class ***
//$obj = new myClass(); //class foo { }
//
//class_alias('foo', 'bar');
//
//$a = new foo;
//$b = new bar;
//
//// the objects are the same
//var_dump($a == $b, $a === $b);
//var_dump($a instanceof $b);
//
//// the classes are the same
//var_dump($a instanceof foo);
//var_dump($a instanceof bar);
//
//var_dump($b instanceof foo);
//var_dump($b instanceof bar);
//instanceof判断变量是不是继承了后面的类 //if (class_exists('MyClass')) {
// $myclass = new MyClass();
//} //class foo {
// static public function test() {
// var_dump(get_called_class());
// }
//}
//
//class bar extends foo {
//}
//
//foo::test();
//bar::test(); //class myclass {
// // constructor
// function myclass33()
// {
// return(true);
// }
//
// // method 1
// function myfunc1()
// {
// return(true);
// }
//
// // method 2
// function myfunc2()
// {
// return(true);
// }
//}
//
//$class_methods = get_class_methods('myclass');
//// or
//$class_methods = get_class_methods(new myclass());
//
//foreach ($class_methods as $method_name) {
// echo "$method_name\n";
//} //class myclass {
//
// var $var1; // 此变量没有默认值……
// var $var2 = "xyz";
// var $var3 = 100;
// private $var4; // PHP 5
//
// // constructor
// function myclass1() {
// // change some properties
// $this->var1 = "foo";
// $this->var2 = "bar";
// return true;
// }
//
//}
//
//$my_class = new myclass();
//echo get_class($my_class);
//$class_vars = get_class_vars(get_class($my_class));
//
//foreach ($class_vars as $name => $value) {
// echo "$name : $value\n";
//} //返回所有的类名
//print_r(get_declared_classes()); //print_r(get_declared_interfaces()); //class dad {
// function dad()
// {
// // implements some logic
// }
//}
//
//class child extends dad {
// function child()
// {
// echo "I'm " , get_parent_class($this) , "'s son\n";
// }
//}
//
//class child2 extends dad {
// function child2()
// {
// echo "I'm " , get_parent_class('child2') , "'s son too\n";
// }
//}
//
//$foo = new child();
//$bar = new child2(); //class WidgetFactory
//{
// var $oink = 'moo';
//}
//
//// create a new object
//$WF = new WidgetFactory();
//
//if (is_a($WF, 'WidgetFactory')) {
// echo "yes, \$WF is still a WidgetFactory\n";
//} //$directory = new Directory('.');
//var_dump(method_exists($directory,'read')); /*
*
call_user_func_array — 调用回调函数,并把一个数组参数作为回调函数的参数
call_user_func — 把第一个参数作为回调函数调用
create_function — Create an anonymous (lambda-style) function
* create_function — 创建一匿名方法lambda_XXX风格
*
forward_static_call_array — Call a static method and pass the arguments as array
* forward_static_call_array — 调用一个静态方法和传递实参数组
*
forward_static_call — Call a static method
* forward_static_call — 调用一个静态方法
*
func_get_arg — 返回参数列表的某一项
func_get_args — 返回一个包含函数参数列表的数组
func_num_args — Returns the number of arguments passed to the function
* func_num_args — 返回参数传递给函数的数量
*
function_exists — 如果给定的函数已经被定义就返回 TRUE
get_defined_functions — Returns an array of all defined functions
* get_defined_functions —返回一个数组定义的所有函数
*
register_shutdown_function — Register a function for execution on shutdown
* register_shutdown_function —注册一个函数执行关闭
*
register_tick_function — Register a function for execution on each tick
* register_tick_function — 登记每个刻度的执行功能
*
unregister_tick_function — De-register a function for execution on each tick
* unregister_tick_function — 去注册一个函数的每个刻度的执行
*
*
*
*/ //function foobar($arg, $arg2) {
// echo __FUNCTION__, " got $arg and $arg2\n";
//}
//class foo {
// function bar($arg, $arg2) {
// echo __METHOD__, " got $arg and $arg2\n";
// }
//}
//
//
//// Call the foobar() function with 2 arguments
//call_user_func_array("foobar", array("one", "two"));
//echo '<br>';
//// Call the $foo->bar() method with 2 arguments
//$foo = new foo;
//call_user_func_array(array($foo, "bar"), array("three", "four")); //error_reporting(E_ALL);
//function increment($var)
//{
// $var++;
//}
//
//$a = 0;
//call_user_func('increment', $a);
//echo $a."\n";
//
//call_user_func_array('increment', array(&$a)); // You can use this instead before PHP 5.3
//echo $a."\n"; //$newfunc = create_function('$a,$b', 'return "ln($a) + ln($b) = " . log($a * $b);');
//echo "New anonymous function: $newfunc";
//echo '<br>';
//echo $newfunc(2, 5); //class A
//{
// const NAME = 'A';
// public static function test() {
// $args = func_get_args();
// echo static::NAME, " ".join(',', $args)." \n";
// }
//}
//
//class B extends A
//{
// const NAME = 'B';
//
// public static function test() {
// echo self::NAME, "\n";
// forward_static_call_array(array('A', 'test'), array('more', 'args'));
// forward_static_call_array( 'test', array('other', 'args'));
// }
//}
//
//B::test('foo');
//
//function test() {
// $args = func_get_args();
// echo "C ".join(',', $args)." \n";
// }
//
// echo function_exists('test'); //function myrow($id, $data)
//{
// return "<tr><th>$id</th><td>$data</td></tr>\n";
//}
//
//$arr = get_defined_functions();
//
//print_r($arr); //function shutdown()
//{
// // This is our shutdown function, in
// // here we can do any last operations
// // before the script is complete.
//
// echo 'Script executed with success', PHP_EOL;
//}
//
//register_shutdown_function('shutdown'); /*
*
filter_has_var — Checks if variable of specified type exists
* filter_has_var — 检查输入变量的指定类型的存在
*
filter_id — Returns the filter ID belonging to a named filter
* filter_id — 返回过滤器ID属于一个名叫过滤器
*
filter_input_array — Gets external variables and optionally filters them
* filter_input_array — 获取多个输入变量,并通过相同的或不同的过滤器对它们进行过滤
*
filter_input — Gets a specific external variable by name and optionally filters it
* filter_input — 获取一个输入变量,并对它进行过滤
*
filter_list — Returns a list of all supported filters
* filter_list — 返回支持的过滤器的所有列表
*
filter_var_array — Gets multiple variables and optionally filters them
* filter_var_array —通过相同的或不同的过滤器来过滤多个变量
*
filter_var — Filters a variable with a specified filter
* filter_var — 通过一个指定的过滤器来过滤单一的变量
*
*/ //http://www.test.com/zzz.php?email=1 //Email Found //if ( !filter_has_var(INPUT_GET, 'email') ) {
// echo "Email Not Found";
// }else{
// echo "Email Found";
// } //$filters = filter_list();
//foreach($filters as $filter_name) {
// echo $filter_name .": ".filter_id($filter_name) ."<br>";
//} //print_r(filter_list());
//
//下面是支持所有过滤类型
//
// [0] => int
// [1] => boolean
// [2] => float
// [3] => validate_regexp
// [4] => validate_url
// [5] => validate_email
// [6] => validate_ip
// [7] => string
// [8] => stripped
// [9] => encoded
// [10] => special_chars
// [11] => full_special_chars
// [12] => unsafe_raw
// [13] => email
// [14] => url
// [15] => number_int
// [16] => number_float
// [17] => magic_quotes
// [18] => callback //$int = 123;
//
//if(!filter_var($int, FILTER_VALIDATE_INT))
// {
// echo("Integer is not valid");
// }
//else
// {
// echo("Integer is valid");
// } // $var=300;
//
//$int_options = array(
//"options"=>array
// (
// "min_range"=>0,
// "max_range"=>256
// )
//);
//
//if(!filter_var($var, FILTER_VALIDATE_INT, $int_options))
// {
// echo("Integer is not valid");
// }
//else
// {
// echo("Integer is valid");
// } //http://www.test.com/zzz.php?age=10&email=222@qq.com&name=rrdsadsadas //$filters = array
// (
// "name" => array
// (
// "filter"=>FILTER_SANITIZE_STRING
// ),
// "age" => array
// (
// "filter"=>FILTER_VALIDATE_INT,
// "options"=>array
// (
// "min_range"=>1,
// "max_range"=>120
// )
// ),
// "email"=> FILTER_VALIDATE_EMAIL,
// );
//
//$result = filter_input_array(INPUT_GET, $filters);
//
//if (!$result["age"])
// {
// echo("Age must be a number between 1 and 120.<br />");
// }
//elseif(!$result["email"])
// {
// echo("E-Mail is not valid.<br />");
// }
//else
// {
// echo("User input is valid");
// } //function convertSpace($string)
//{
//return str_replace("_", " ", $string);
//}
//
//$string = "Peter_is_a_great_guy!";
//
//echo filter_var($string, FILTER_CALLBACK, array("options"=>"convertSpace")); /*
*
* 字符类型检测
*
ctype_alnum — 做字母和数字字符检测
ctype_alpha — 做纯字符检测 包括大小写
ctype_cntrl — 做控制字符检测
ctype_digit — 做纯数字检测
ctype_graph — 做可打印字符串检测,空格除外 比如\n\t会被过滤
ctype_lower — 做小写字符检测
ctype_print — 做可打印字符检测 和ctype_graph很类似,但是包括空格
ctype_punct — 检测可打印的字符是不是不包含空白、数字和字母
ctype_space — 做空白字符检测
ctype_upper — 做大写字母检测
ctype_xdigit — 检测字符串是否只包含十六进制字符
*
*/ //$strings = array('AbCd1zyZ9', 'foo!#$bar');
//foreach ($strings as $testcase) {
// if (ctype_alnum($testcase)) {
// echo "只含有字母和数字";
// echo '<br>';
// } else {
// echo "不止包含字母和数字";
// echo '<br>';
// }
//} //$strings = array('KjgWZC', 'arf12');
//foreach ($strings as $testcase) {
// if (ctype_alpha($testcase)) {
// echo "只含有字母";
// echo '<br>';
// } else {
// echo "不止包含字母";
// echo '<br>';
// }
//} //$strings = array('string1' => "\n\r\t", 'string2' => 'arf12');
//foreach ($strings as $name => $testcase) {
// if (ctype_cntrl($testcase)) {
// echo "包含控制字符";
// } else {
// echo "不止包含控制字符";
// }
//} //$strings = array('1820.20', '10002', 'wsl!12');
//foreach ($strings as $testcase) {
// if (ctype_digit($testcase)) {
// echo "只包含纯数字";
// } else {
// echo "不只包含纯数字";
// }
//} //$strings = array('string1' => "asdf\n\r\t", 'string2' => 'arf12', 'string3' => 'LKA#@%.54');
//foreach ($strings as $name => $testcase) {
// if (ctype_graph($testcase)) {
// echo "所有字符打印时候都是可见的";
// } else {
// echo "不是所有字符打印时候都是可见的";
// }
//} //$strings = array('aac123', 'qiutoas', 'QASsdks');
//foreach ($strings as $testcase) {
// if (ctype_lower($testcase)) {
// echo "所有字符都是小写";
// } else {
// echo "不是所有字符都是小写";
// }
//} //$strings = array('string1' => "asdf\n\r\t", 'string2' => 'arf12', 'string3' => 'LKA#@%.54');
//foreach ($strings as $name => $testcase) {
// if (ctype_print($testcase)) {
// echo "所有字符打印时候都是可见的";
// } else {
// echo "不是所有字符打印时候都是可见的";
// }
//} //$strings = array('ABasdk!@!$#', '!@ # $', '*&$()');
//foreach ($strings as $testcase) {
// if (ctype_punct($testcase)) {
// echo "字符不包含空白、数字和字母";
// } else {
// echo "字符包含空白、数字和字母";
// }
//} //$strings = array('string1' => "\n\r\t", 'string2' => "\narf12", 'string3' => '\n\r\t');
//foreach ($strings as $name => $testcase) {
// if (ctype_space($testcase)) {
// echo "所有字符打印时候都是可见的";
// } else {
// echo "不是所有字符打印时候都是可见的";
// }
//} //$strings = array('AKLWC139', 'LMNSDO', 'akwSKWsm');
//foreach ($strings as $testcase) {
// if (ctype_upper($testcase)) {
// echo "所有字符都是大写";
// } else {
// echo "不是所有字符都是大写";
// }
//} //$strings = array('AB10BC99', 'AR1012', 'ab12bc99');
//foreach ($strings as $testcase) {
// if (ctype_xdigit($testcase)) {
// echo "所有字符都是十六进制";
// } else {
// echo "不是所有字符都是十六进制";
// }
//}

php函数研究的更多相关文章

  1. Windows编程之connect函数研究

    写在前面:本博客为本人原创,严禁任何形式的转载!本博客只允许放在博客园(.cnblogs.com),如果您在其他网站看到这篇博文,请通过下面这个唯一的合法链接转到原文! 本博客全网唯一合法URL:ht ...

  2. jquery的匿名函数研究

    jQuery片段: ? 1 2 3 ( function (){ //这里忽略jQuery所有实现 })(); 半年前初次接触jQuery的时候,我也像其他人一样很兴奋地想看看源码是什么样的.然而,在 ...

  3. 黑马程序员——利用swap函数研究C的指针

    ------Java培训.Android培训.iOS培训..Net培训.期待与您交流! ------- 设计3个函数,分别实现已下功能: 交换两个整数 交换两个整形指针 交换任意两个同类型的变量 #i ...

  4. PHP很有用的一个函数ignore_user_abort ()

    PHP很有用的一个函数ignore_user_abort () 2013-01-16 14:21:31|  分类: PHP |  标签:php  函数  |举报|字号 订阅     ignore_us ...

  5. UIApplication深入研究

    我们偶尔会调用这个类的api来实现一些功能,但是这个类是iOS编程中很重要的一个概念,所以总结以下这个类的信息,不对的地方请留言. UIApplication的核心作用是提供了iOS程序运行期间的控制 ...

  6. iOS工程中的info.plist文件的完整研究

    原地址:http://blog.sina.com.cn/s/blog_947c4a9f0100zf41.html 们建立一个工程后,会在Supporting files下面看到一个"工程名- ...

  7. PHP 函数 ignore_user_abort()

    ignore_user_abort 设置与客户机断开是否会终止脚本的执行.   本函数返回 user-abort 设置的之前的值(一个布尔值). int ignore_user_abort ([ st ...

  8. 第1期 考研中有关函数的一些基本性质《zobol考研微积分学习笔记》

    在入门考研微积分中,我们先复习一部分中学学的初等数学的内容.函数是非常有用的数学工具. 1.函数的性质理解: 首先考研数学中的所有函数都是初等函数.而函数的三个关键就是定义域.值域.对应关系f. 其中 ...

  9. iOS UIApplication sharedapplication用法

    应用中打开其他应用 我们来讨论一下,在iOS开发中,如何实现从app1打开app2. 基本的思路就是,可以为app2定义一个URL,在app1中通过打开这个URL来打开app2,在此过程中,可以传送一 ...

随机推荐

  1. theano报一种float类型错误的处理办法

    我实际用的环境是Keras,查错误时查到是Theano的配置问题,所以在标题里就写成Theano的问题了, 是这样的,从Github上下载的别人的代码,准备复现别人的实验,结果在机器上部署好环境之后跑 ...

  2. 使用Gson排除特定字段

    http://blog.csdn.net/hknock/article/details/51037564

  3. KMP(fail数组应用) LA 3026 Period

    题目传送门 题意:(训练指南P213) 求每个前缀的最短循环节 分析:利用失配函数的性质,如果i % (i - fail[i]) == 0,那么正好错位移动一个循环节长度. #include < ...

  4. 使用Adobe Edge Inspect在各种设备中轻松测试同一页面

    有过移动网站开发经历的开发者都知道,在各种设备中测试同一页面是一项非常繁琐的工作.现在,我们可以使用Adobe Edge Inspect来简化这一工作.如果使用Edge Inspect,可以在各种设备 ...

  5. 洛谷 P1341 无序字母对 Label:欧拉路 一笔画

    题目描述 给定n个各不相同的无序字母对(区分大小写,无序即字母对中的两个字母可以位置颠倒).请构造一个有n+1个字母的字符串使得每个字母对都在这个字符串中出现. 输入输出格式 输入格式: 第一行输入一 ...

  6. 【BZOJ1208】[HNOI2004]宠物收养所 Splay

    还是模板题,两颗splay,找点删即可. #include <iostream> #include <cstdio> #include <cstdlib> #def ...

  7. ThinkPhp循环出数据库中的内容并输出到模板

    <foreach name='user' item='v'> //循环出数据库中的内容 对应控制器->方法中的  $this->assign('user',M('user')- ...

  8. jQuery学习笔记(一):入门【转】

    由于工作的需要,发现JQuery是一个绕不开的东西,现在开始学习. 一.JQuery是什么 JQuery是什么?始终是萦绕在我心中的一个问题: 借鉴网上同学们的总结,可以从以下几个方面观察. 不使用J ...

  9. java分享第三天(异常)

    异常的处理办法之一 捕获异常(try,catch,finally) 1 try语句指定了一段代码,该段代码就是一次捕获并处理的范围.在执行过程中,当任意一条语句产生异常时,就会跳过该段中后面的代码.代 ...

  10. [LintCode] Maximal Rectangle 最大矩形

    Given a 2D boolean matrix filled with False and True, find the largest rectangle containing all True ...