脚本宝典收集整理的这篇文章主要介绍了简单高效的php内置函数(二) ,脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
- 1.返回由对象属性组成的关联数组
array get_object_VARs( object $obj)
- 2.返回一个常量的值使用函数 constant
define("MAXSIZE", 100);
echo MAXSIZE;
echo constant("MAXSIZE"); // same thing as the previous line
interface bar {
const test = 'foobar!';
}
class foo {
const test = 'foobar!';
}
$const = 'test';
var_dump(constant('bar::'. $const)); // string(7) "foobar!"
var_dump(constant('foo::'. $const)); // string(7) "foobar!"
- 3.将一个或多个单元压入数组的末尾(入栈)
array array_push ( array $array , mixed $var [, mixed $... ] )
- 4.在 haystack 中搜索 needle,如果没有设置 strict 则使用宽松的比较。若 strict 的值为 TRUE 则 in_array() 函数还会检查 needle 的类型是否和 haystack 中的相同。
bool in_array ( mixed $needle , array $haystack [, bool $strict = FALSE ] )
以上是脚本宝典为你收集整理的
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。