chr(): Return a specific character Return a specific character
The ascii code.
Ex.
<?php
$str = "o/p of function: ";
$str .= "--".chr(98)."--";
 .. |
|
chunk_split():Split a string into smaller chunks Split a string into smaller chunks
string chunk_split ( string $str [, int $chunklength = 76 [, string $end = "rn" ]] )
string chunk_split ( 'The string to be chunked.','The chunk length.. |
|
count_chars(): Return information about characters used in a string Return information about characters used in a string
count_chars ( string $string [, int $mode = 0 ] )
count_chars ( 'The examined string', 'See return values' )
Ex:
<?php
$data .. |
|
crc32(),md5(),sha1() crc32(): Calculates the crc32 polynomial of a string
sha1():Calculate the sha1 hash of a string
<?php
$val = crc32("Pankaj Raghuwanshi");
echo $val;
echo "<br>&quo.. |
|
|
|
explode() Split a string into Array explode() Split a string into Array
array explode ( [string $delimiter] , [string $string] , [int $limit] )
EX:
<?php
$strng = 'a|bb|ccc|dddd';
print_r(explode('|', $strng));
e.. |
|
htmlentities():Convert all applicable characters to HTML entities string htmlentities ([string $string ], [int $quote_style] , [string $charset])
quote_style
ENT_NOQUOTES Will leave both double and single quotes unconverted.
ENT_QUOTES &nbs.. |
|
htmlspecialchars():Convert special characters to HTML entities string htmlspecialchars ( [string $string], [int $quote_style], [string $charset], [bool $double_encode = true] )
'>' (greater than) becomes '>'
'<' (less than) becomes '<'
.. |
|
htmlspecialchars_decode():Convert special HTML entities back to characters htmlspecialchars_decode():Convert special HTML entities back to characters
string htmlspecialchars_decode(string $string,int $quote_style)
quote_style
ENT_QUOTES Will convert both d.. |
|
html_entity_decode():Convert all HTML entities to their applicable characters string html_entity_decode ( string $str, int $quoteStyle, string $charset )
str is: any type string
quoteStyle are:
ENT_NOQUOTES Will leave both double and single quotes unconvert.. |
|
implode():Array elements convert into a string string implode ( [string $glue] , [array $pieces] )
Return a string value
<?php
$array = array('Somesh', 'Birjesh', 'Raju');
$val = implode(":.. |
|
number_format(number,decimals,decimalpoint,separator) number_format(number,decimals,decimalpoint,separator)
number:Be formatted.
decimals:For how many decimals place(Optional).
decimalpoint: decimal indicator(Optional).
separator: Default value is&qu.. |
|
String Formating Functions lcfirst( string $string ): First character of string in lowercase
ucfirst(string $string): First character of string in uppercase
ucwords(string $str): Returns a string with the first character of e.. |
|
strip_tags() Mostly this function is use in front end of website when we fill the form this function Strip HTML and PHP tags from a string
string strip_tags ( [string $str], [string $allowable_tags] )
we can und.. |
|
strpos() and stripos() int strpos ( [string $mystring] , [mixed $findme], [int $offset] )
return position of first occurrence of a string
Note: counting start from '0'.
<?php
$strng = 'my job is account teache.. |
|
strstr():Finds the first occurrence of a string string strstr ( string str, string needle )
string stristr ( string str, string needle )
Ex.
<?
$url = "www.xxx.com";
$domain = strstr ($url, ".");
echo $domain;
?>
.. |
|
substr(): Returns a piece of a string string substr ( string string, int start [, int length] )
<?PHP
$str= "Hello, how are you today? I am fine!";
if (strlen ($str) >= 30){
echo substr ($str,0.. |
|
substr_count() Counts the number of substring occurrences
php program
function searchtext ($haystack, $needle){
if (substr_count ($haystack, $needle) == 0){
&nb.. |
|
substr_replace(): Replaces text within a portion of a string Replacing Substrings
string substr_replace ( string str, string replacmnt, int start [, int len] )
replace the entire instance (say, by changing the ever-so-clichéd "Hello World!".. |
|