易截截图软件、单文件、免安装、纯绿色、仅160KB

php array一些函数

我们手头的PHP资料不多,大家是不是都有一份php4gb.chm。我最欣赏它里面的函数库部分了,真正的在线帮助。但是PHP发展的脚步实在太快了,你睢,我最近在www.php.net/manual/ 又找到了一些扩展的数组函数。
下面我把它们介绍给大家吧,我的英文水平不高,有译的不对的地方,请指正。
格式是这样的:
函数名 支持版本
函数声明
说明及参数、返回值
例子
OK,Let's go.
//*************************
array_flip (PHP4 >= 4.0b4)
array array_flip (array trans)
将数组trans的key、value交换,就是key变value,而value变key了。
返回完成处理的数组。
例:
$a[0]="abc";
$a[1]="def";
After an array_flip() you get:
$a["abc"]=0; $a["def"]=1;
//***************************
array_count_values (PHP4 >= 4.0b4)
array array_count_values (array input)
统计input数组中各个值的个数。返回一个数组,以input的值做为key,以出现个数为value的新数组。
例:
$array = array (1, "hello", 1, "world", "hello");
array_count_values ($array);
// returns array (1=>2, "hello"=>2, "world"=>1)
//*****************************
array_merge (PHP4 )
array array_merge (array array1, array array2 [, array ...])
合并多个数组,把array2的内容加在array1的后面。返回结果数组。
如果是关联数组,以字串为key,出现同名的key,则后面的会覆盖前面的,而下标数组不会出现覆盖的现象,只是添加在后面。
例:
$array1 = array ("color" => "red", 2, 4);
$array2 = array ("a", "b", "color" => "green", "shape" => "trapezoid", 4);
array_merge ($array1, $array2);
//Resulting array will be array("color" => "green", 2, 4, "a", "b", "shape" => "trapezoid", 4).
See also array_merge_recursive().
//******************************
array_merge_recursive (PHP4 >= 4.0.1)
array array_merge_recursive (array array1, array array2 [, array ...])
递归合并数组,与上个函数基本类似。区别在于,在关联数组方面,它不是简单地把相同的key合并,还是生成一个二维数组来合并这相同key的value。(表达不清,不好意思,看例子吧)。
例:
$ar1 = array ("color" => array ("favorite" => "red"), 5);
$ar2 =


相关文档:

php 不用COM 生成excel文件

用php生成excel文件
<?
header("Content-type:application/vnd.ms-excel");
header("Content-Disposition:filename=test.xls");
echo "test1/t";
echo "test2/t/n";
echo "test1/t";
echo "test2/t/n";
echo "test1/t";
echo "test2/t/n";
echo "test1/t";
echo "test2/t/n";
echo "test1/t";
echo "test2 ......

Integrating PHP and Perl


Perl is a language often associated with text processing and CGI. PHP is
a language often associated with dynamic Web pages. Both are very popular
with Web developers. Often, each of these languages is used at the expense of
the other. Hard-core Perl developers would love to develop everyth ......

PHP 中的 常量 变量 魔术常量 ...


PHP 向它运行的任何脚本提供了大量的预定义常量
。不过很多常量都是由不同的扩展库定义的,只有在加载了这些扩展库时才会出现,或者动态加载后,或者在编译时已经包括进去了。
有五个魔术常量根据它们使用的位置而改变。例如 __LINE__
的值就依赖于它在脚本中所处的行来决定。这些特殊的常量不区分大小写,如下:
表 ......

php入门教程 精简版(附视频)

1、嵌入方法:
类似ASP的<%,PHP可以是<?php或者是<?,结束符号是?>,当然您也可以自己指定。
2、引用文件:
引用文件的方法有两种:require 及 include。
require 的使用方法如 require("MyRequireFile.php"); 。这个函数通常放在 PHP 程序的最前面,PHP 程序在执行前,就会先读入 require 所指定引入 ......

【转】高级PHP应用程序漏洞审核技术




作者:Ph4nt0m Security Team
来源:http://www.ph4nt0m.org-a.googlepages.com/PSTZine_0x03_0x06.txt
==Ph4nt0m Security Team==

Issue 0x03, Phile #0x06 of 0x07

|=---------------------------------------- ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号