The str_repeat() function is used to repeat a string, a specified number of times. This function was introduced in PHP4. The function returns a string consisting of count copies of string appended to each other. If the count is not greater than 0, an empty string is returned. Syntax: str_repeat(string $string, int $times): string Parameters […]
PHP
PHP function str_ireplace() – Case-insensitive version of str_replace()
The str_ireplace() function is used to replace some case insensitive characters in a string. This function was introduced in PHP5. Performs a case-insensitive search for all occurrences of search in string and replaces them with replace. If all three parameters are strings, a string is returned. If string is an array, the replacement is performed […]
PHP function convert_cyr_string() – Convert from one Cyrillic character set to another
The convert_cyr_string() function is used to convert a string from one Cyrillic character-set to another set. It was introduced in PHP3. The character sets to be converted are specified with a single character code. Look at the types that are supported by this function: “k – koi8-r “w – windows-1251 “i – iso8859-5 “a – […]
PHP function chunk_split() – Split a string into smaller chunks
The chunk_split() function divides a string into a sequence of small fragments. chunk_split() adds the character(s) specified in chunk_ending every chunk_length characters. This function is useful for breaking certain types of data into separate lines of a specified length. It’s often used to make base64 encoded data conform to RFC 2045. This function was introduced […]
PHP function chr() – Generate a single-byte string from a number
The chr() function returns a single character string from an ASCII value that is already specified. If the integer provided is not a valid ASCII code, the function returns nothing. This function was introduced in PHP3. Note that the integer can be specified in octal or hex values, as well as decimal. Octal values are […]
PHP function chop() – Alias of rtrim()
The chop() function is the pseudonym of rtrim(). This function was introduced in PHP3. chop() removes all trailing whitespace characters from the given string. These characters include the horizontal tab (\t), linefeed (\n), vertical tab (\013), carriage return (\r), and space (‘ ”) characters. Syntax: string chop(string string) Return Values String stripped of trailing whitespace […]
PHP function bin2hex – Convert binary data into hexadecimal representation
The bin2hex() function converts a string of ASCII characters to hexadecimal values. This was introduced in PHP3. This function Converts binary to a hexadecimal (base-16) value. Up to a 32-bit number, or 2,147,483,647 decimal, can be converted. Note that any value passed to the function is converted to an ASCII string (if possible). The string […]
PHP decbin function – Decimal to binary
The PHP function decbin() converts a decimal number into a string containing its binary representation. The largest decimal value that can be converted is 2147483647. If you have to deal with larger numbers, you need to write a custom function to handle the values. It takes just one parameter, which is the number to convert. […]
htaccess Cheatsheet
Here is a simple cheatsheet for the .htaccess file: Enable Directory Browsing Options +Indexes ## block a few types of files from showing IndexIgnore *.wmv *.mp4 *.avi Disable Directory Browsing Options All -Indexes Customize Error Messages ErrorDocument 403 /forbidden.html ErrorDocument 404 /notfound.html ErrorDocument 500 /servererror.html Get SSI working with HTML/SHTML AddType text/html .html AddType text/html […]
PHP cos function – Cosine
Description The cos() function calculates the cosine value of the number provided as its only parameter. The parameter should be passed as radians—you should use deg2rad() to convert degrees to radians. $cos1 = cos(10); $cos2 = cos(deg2rad(80)); Syntax: cos(float $num): float Parameters Parameter Description num An angle in radians Return Values Returns the cosine of […]