Category Archives: PHP

addcslashes

Syntax: string addcslashes ( string $str , string $charlist ) Description: Returns a string with backslashes before characters that are listed in charlist parameter.A list of characters to be escaped. Example 1 <?php $str=”hai…i like india”; echo ‘Input String :’.$str; echo ‘<br/>’; echo ‘Output String (addcslashes($str,”i”)) : ‘.addcslashes($str,’i’); echo ‘<br/>’; ?> OUTPUT Input String :hai…i like india Output […]

addslashes

Syntax: string addslashes ( string $str ) Description: Returns a string with backslashes before characters that need to be escaped. These characters are single quote (‘), double quote (“), backslash (\) and NUL Note: Using addcslashes() function we will configure the escaped string. Example 1 <?php $str=”How’re you”; echo ‘Input String :’.$str; echo ‘<br/>’; echo ‘Output String (addslashes($str)) […]

array_splice

Syntax:array array_splice ( array &$input , int $offset [, int $length = 0 [, mixed $replacement ]] ) Description:Remove a portion of the array and replace it with something else <?php $input = array(“red”, “green”, “blue”, “yellow”); array_splice($input, 2); print_r($input); echo “<br/>”; $input = array(“red”, “green”, “blue”, “yellow”); array_splice($input, 1, -1); print_r($input); ?> OUTPUT Array […]

bin2hex

Syntax: string bin2hex ( string $str ) Description: Returns an ASCII string containing the hexadecimal representation of str. Note: Using addcslashes() function we can configure the escaped string. Example <?php $str=”good morning”; echo bin2hex($str); ?> OUTPUT 676f6f64206d6f726e696e67  

chop

Syntax: chop() — Alias of rtrim() Description: This function is an alias of: rtrim(). Example 1 <?php $str1=”hai “; $str2=”good “; $str3=”morning “; echo $str1.$str2.$str3; echo ‘<br/>’; echo chop($str1).chop($str2).chop($str3); ?> OUTPUT hai good morning haigoodmorning Example 2 <?php $str1=”hai are YOU”; echo chop($str1,’A..Z’); ?> OUTPUT hai are