class name before function arguments
I often see some “programming gurus” use strange advanced syntax such as this one: somefunction(\WP_Query $query) { …. } This is a piece of php code. You know, usually php […]
I often see some “programming gurus” use strange advanced syntax such as this one: somefunction(\WP_Query $query) { …. } This is a piece of php code. You know, usually php […]
You may have noticed the strange strings in WordPress’ wp_options table(in some option_value) like this: a:3:{i:0;i:123;s:3:”abc”;i:456;i:789;s:3:”def”;} It seems you can decipher it but it is not very easy to read. […]
Both var_dump and print_r can print php variables in detail. What is the difference between print_r and var_dump? print_r displays less information than var_dump, thus more concise. print_r only shows […]
Php has a SimpleXMLElement class to parse xml document. The official website gives quite a few examples on how to use it, but no explanation of related concepts. xml has […]
Html elements are so easy to learn. Even you are not major in computer science, even you are not a programmer, you can easily master them and use them to […]
The flag parameter of preg_match_all is complicated and confusing. The official document says the default value of flag is 0, which is wrong. In fact, the flag parameter is defaulted […]
You might think it is a hard work to upload a file. At the client side, do I need to write code to open the file, read its content, then […]
We know the result of C integer division is an integer: 1/2=0, 1/3=0, 3/2=1. To get the remainder of integer division, you need to use %. To get the float […]
C programmer knows how to display float 2 decimal places with printf. In php, how to round float to 2 decimal places? It is definitely necessary to echo float with […]
php iconv is an interesting function that can convert a string from one charset to another. $text=”abc”; $text = iconv(‘utf-8’, ‘us-ascii’, $text); In the above example, since the source file […]