程序員的備忘錄
显示标签为“
PHP
”的博文。
显示所有博文
显示标签为“
PHP
”的博文。
显示所有博文
2013年4月18日星期四
array個數(PHP、JAVA)
PHP
$array=array(0,1,2,3);
echo count($array) \\==> 4
JAVA
int[] array=new int[]{0,1,2,3};
echo array.length \\==> 4
PHP日期符合資料庫格式
MySQL的日期資料格式是像這樣的
2013-03-14 20:40:17
那如何讓PHP顯示的日期也變成這樣呢?
PHP程式碼:
echo date('Y-m-d H:m:s') //==>顯示現在的時間,格式同資料庫的格式。
如果需要自訂時間的話,可以用
echo date('Y-m-d H:m:s',mktime(date("H"), date("i"),
date("s")
, date("m")-1, date("d"), date("Y")));
//顯示上個月份今日,其中mktime的參數順序為時、分、秒、月、日、年,格式同資料庫用
參考
http://www.php.net/manual/en/function.mktime.php
substring mothod for JAVA、PHP、javascript
以下為PHP、JAVA、javascript的substring語法
PHP
string
substr
(
string
$string
,
int
$start
[,
int
$length
] )
JAVA
public String substring(int beginIndex)
or
public String substring(int beginIndex, int endIndex)
javascript
string.substring(from, to)
String length method for PHP、JAVA、javascript
PHP:
int
strlen
(
string
$string
)
JAVA:(String object)
public int length()
javascript:
string.length
较旧的博文
主页
订阅:
博文 (Atom)