[PHP] Practical functions 4_php Tips

Source: Internet
Author: User
Tags current time mixed string format
Output Information page about PHP and current instructions

int phpinfo (void)
Returns the current PHP version number

String phpversion (void)
Print out a list of people who contribute to this PHP project

String phpcredits (void)
var can be converted to an integer type. Base is the base of the transformation, and the default value is 10. The converted variable var can be an array or a class of
Any type variable

int intval (mixed var,int[base])
Get the double value of a variable

Double Doubleval (mixed Var)
To get the string value of a variable

String Strval (mixed var)
Returns the type of a variable

String GetType (mixed Var)
Sets the type of the variable. Returns true if the conversion succeeds

int Settype (string var,string type)
To sort the elements of an array

void sort (array array)
Reverse order of array elements

void Rsort (array array)
Apply a user function to each element of an array

int Array_walk (Array array,string func)
Calculate the number of elements in an array

int count (mixed var)
Causes the internal pointer of an array parameter to point to the last element and returns the element

Mixed end (array array)
Causes the internal pointer of an array parameter to point to the previous element and returns the element

Mixed prev (array array)
Causes the internal pointer of an array parameter to point to the next element and returns the element

Mixed next (array array)
Causes the internal pointer of an array parameter to point to the 1th element and returns the element

Mixed reset (array array)
Returns the element that the current array's internal pointer points to

Mixed current (array array)
To see if the haystack array has needle given this value, strict means a strict match (default)

BOOL In_array (mixed Needle,array Haystack,[,bool Strict])
Returns the index value of the next element in an array

Array each (array array)
Add the element to the end of the array

int Array_push (array stack,mixed var[,mixed ...])
POPs an element from the end of the array

Mixed Array_pop (array stack)
POPs an element from the beginning of the array

Mixed Array_shift (array stack)
Return the element to the beginning of the array

Mixed Array_unshift (array stack)
Returns the current UNIX format timestamp

int time (void)
Enter a time parameter to return the UNIX format timestamp

int mktime (int hour,int minute,int second,int month,int day,int year)
Get a UNIX timestamp format for Greenwich time

int gmmktime (int hour,int minute,int second,int month,int day,int year)
Format a time or date

String date (string Format,int[timestamp])
Get an array of date/time information

Array getdate (int [timestamp])
Returns True if the date is valid

BOOL Checkdate (int month,int day,int [timestamp])
Format the server by time or date expression in the locale

String Strftime (String format,int [timestamp])
Converts a string representing a date and time into a timestamp. A string that can accept most typical data formats. For example, YYYY-MM-DD
and mm/dd/yyyy

int Strtotime (String time,int now)
Gets the current time (Unix timestamp format) value of one out of 10,000 seconds. return string

String Microtime (void)
Returns the current time as an array type

Array gettimeofday (void)
Set random number of

void Srand (int seed)
Returns a random number, without specifying the maximum and minimum range of random numbers, this function automatically takes a random number from 0 to Rand_max
。 If you specify min and Max parameters, a number is taken from the specified parameter

int rand ([int min],[int Max])
Returns the maximum allowable value for a random number

int Getrandmax (void)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.