PHP数组函数array_push
想到PHP操作数组时候,给一个数组添加一个数组单元时候可以有两种方式:
1.
$arr = array();
$arr[] = '';
2.
$arr = array();
array_push($arr,'');
刚做一个100000次的循环插入,结果还是第一种要快一些!(循环插入数字,100000次,第一种0.04左右,第二种0.08秒左右)
相关文档:
[PHP]
;;;;;;;;;;;;;;;;;;;
; About php.ini ;
;;;;;;;;;;;;;;;;;;;
; PHP's initialization file, generally called php.ini, is responsible for
; configuring many of the aspects of PHP's behavior.
; PHP attempts to find and load this configuration from a number of locations.
; The follo ......
在DOS中进行MySQL的访问可能乱码的情况有三种,
首先,要做的是检查MySQL的配置,安装的时候选择utf-8的语言环境会省去很多的麻烦
1. 检查MySQL的服务端、客户端的语言设置是否为“utf8”,不是的话手动将my.int更改过来;
2. 在PHP进行第一次mysql_query之前设置使用连接的字符集为"SET N ......
.$dbhost = 'localhost';
$dbuser = 'root'; //你的mysql用户名
$dbpass = '123456'; //你的mysql密码
$dbname = 'data'; //你的mysql库名
//连接本地数据库
$GLOBALS["conn"] = mysql_connect($dbhost,$dbuser,$dbpass);
//打开数据库
mysql_select ......
首先,建InnoDB类型的表,才能支持事务
$handler = mysql_connect('localhost', '', '');
mysql_select_db('test');
mysql_query('SET AUTOCOMMIT=0'); // 设置为不自动提交查询
mysql_query('START TRANSACTION'); // 开始查询,这里也可以使用BEGIN
mysql_query("INSERT INTO users VALUES ('ccc')");
mysql_query( ......