Remember several basic PHP knowledge points in 20 seconds and basic PHP knowledge in 20 seconds.
Array:
Index Array: the Key of the array is an integer array, starting from 0.
Join array: the Key of the array is an array of strings.
// Index array $ arr = array ('I', 'love', 'you'); // associate the array $ arr0 = array ('apple' => "apple ", 'yellow' => "yellow ");
Foreach traversal Array
// Array traversal $ arr = array ("apple", "yellow"); foreach ($ arr as $ key = >$ value) {echo '<br> the key is: '. $ key. 'corresponding value :'. $ value ;}$ arr0 = array ('apple' => "apple", 'yellow' => "yellow"); foreach ($ arr0 as $ key =>$ value) {echo '<br> key :'. $ key. ', the corresponding value is :'. $ value ;}
Determine whether a function exists: function_exsits (function name)
Function sayHello () {echo 'hello';} $ test = 'sayhel'; if (function_exsits ($ test) {sayHello ();} // output hello
Constructor: method called when an object is created
Destructor: method called when an object is destroyed
Class Car () {public _ construct () {echo 'object created ';} public _ destruct () {echo 'object destroyed ';}} $ car = new Car ();
Strpos: String SEARCH method
$ Str = 'Hello world'; echo strpos ($ str, 'World'); // output 6, starting from 6th bits
Implode: Return Value: combines array elements into a string.
$ Arr = array ('abc', 'defg'); $ arr0 = implode ('', $ arr); print_r ($ arr0); // The result shows abcdefg.
Explode: Return value: the function returns an array composed of strings.
$ Str = "abc, defg"; $ arr = explode (',', $ str); print_r ($ arr); // The result returns an array with two elements: abc and defg
Author: By: Luo Jian yuan http://blog.csdn.net/sunyuan_software