January 11, 2010
Perl、PHP、ASP、JSP技术比较
本文将对目前最常用的四种动态网页语言Perl(Practical Extraction and Report Language)、PHP(Hypertext Preprocessor)、ASP(Active Server Pages)、JSP(JavaServer Pages)进行一些技术性的比较。
PHP Array
Numeric Arrays
A numeric array stores each array element with a numeric index.
There are two methods to create a numeric array.
PHP数组入门教程 (PHP Array)
我不知道PHP
初学者是怎么学习 函数的,但是我认为学习他一定是有目的性,它是目的驱动的,以数组函数为例!这么多的数组函数我们该怎么学习?其实我们只需要清楚,我们需要对数组做哪些操 作,然后把这些操作归类,心中就有了大概的印象,然后随着你的实践,这些函数你就很清楚了,在这里提醒大家的是手册要常备!废话不多说,数组函数一般归为 以下几类(看到英文别怕哦):
(more…)
PHP 隨機數 random mt_rand()
PHP mt_rand() Function
Complete PHP Math Reference
Definition and Usage
The mt_rand() function returns a random integer using the Mersenne Twister algorithm.
If this function is called without parameters, it returns a pseudo-random value between 0 and RAND_MAX.
If you want a random number between 10 and 100 (inclusive), use mt_rand (10,100).
Syntax
| mt_rand(min,max) |
| Parameter | Description |
|---|---|
| min,max | Optional. Specifies the range the random number should lie within |
Tips and Notes
Tip: This function produces a better random value four times faster than rand()!
Note: In PHP 4.2.0 and later, there is no need to seed the random generator with mt_srand(). This is done automatically.
Example
In this example we will return some random numbers:
| <?php echo(mt_rand() . “<br />”); echo(mt_rand() . “<br />”); echo(mt_rand(10,100)) ?> |
The output of the code above could be:
1150905288
613289478
21