Archive | PHP

RSS feed for this section
PHP: Convert Hex Color to RGB, RGB to Hex Color

PHP: Convert Hex Color to RGB, RGB to Hex Color

Example 1: result: Array ( [red] => 0 [green] => 255 [blue] => 103 ) Example 2: result: 0,255,103 Example 3: result: 34,255,102 Example 4: result: Array ( [red] => 34 [green] => 255 [blue] => 102 ) Other function hex2rgb

Read full story Comments { 0 }
Function str_ireplace in PHP4

Function str_ireplace in PHP4

According to the document of PHP official website, http://php.net/str_ireplace str_ireplace (PHP 5) str_ireplace — Case-insensitive version of str_replace(). So, it’s only for PHP5+. In PHP4, we use this function below: Example 1: result: array(3) { [0]=> string(29) “If find and change are arrays” [1]=> string(92) “then str_ichange() takes a value from each array and uses […]

Read full story Comments { 0 }
Function stripos in PHP4

Function stripos in PHP4

According to the document of PHP official website, http://php.net/stripos stripos (PHP 5) stripos — Find the position of the first occurrence of a case-insensitive substring in a string So, it’s only for PHP5+. In PHP4, we use this function below:

Read full story Comments { 0 }
Function http_build_query in PHP4

Function http_build_query in PHP4

According to the document of PHP official website, http://php.net/http_build_query http_build_query (PHP 5) http_build_query — Generate URL-encoded query string So, it’s only for PHP5+. In PHP4, we use this function below:

Read full story Comments { 0 }
PHP: function mb_str_split

PHP: function mb_str_split

mbstring provides multibyte specific string functions that help you deal with multibyte encodings in PHP. In addition to that, mbstring handles character encoding conversion between the possible encoding pairs. mbstring is designed to handle Unicode-based encodings such as UTF-8 and UCS-2 and many single-byte encodings for convenience.

Read full story Comments { 0 }

PHP Generate Random ID’s

First: creat func.php file Usage: Result: dd2djhiwgdpgzn9 n5ktlbi4roi6zhy …. Alternative method, very short:

Read full story Comments { 0 }
Function str_split in PHP4

Function str_split in PHP4

According to the document of PHP official website, http://php.net/manual/en/function.str-split.php str_split (PHP 5) str_split — Convert a string to an array

Read full story Comments { 0 }
PHP CURL class support basic authorization, HTTP SOCKS5 proxy and much more

PHP CURL class support basic authorization, HTTP SOCKS5 proxy and much more

This is a useful class written by me and use it regularly. Features HTTPS connection Basic authorization, HTTP proxy SOCKS5 proxy Cookie jar and much more… For some usage, you can read more: PHP & CURL: step by step

Read full story Comments { 1 }
PHP & CURL: step by step

PHP & CURL: step by step

After you read this article: Getting data without risking death with PHP, CURL, you’ve seen the power of CURL. I’ll write more about CURL to introduce a useful PHP class written by me and use it regularly. But first let’s take a CURL research through the examples, step by step: Example 1: GET, include response […]

Read full story Comments { 0 }
Page generated in seconds x.xxxx

Page generated in seconds x.xxxx

You’ve probably noticed at some sites a little message, mainly in the page footer, type ‘ Page generated in 0th seconds …. ‘or something similar. Here you can learn how to easily make using PHP microtime() function

Read full story Comments { 0 }