STRINGS
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
string:-collection of characters and words.
1)implode():-implode(",",array):-it will return the array with seperated ,
supposing i am giving * instead of , it will return the array with * seperator.
2)explode():-(" ",array)
it will return where the space is there ,that is treated
an element,we should print index wise of the element.
//see example string4.php
3)str_repeat():-str_repeat("*=",10)//o/p *=*=*=up to 10 times
4)str-replace():-str_replace($string1," ","this is apparao");
it will return the first string and this is apparao ,first check the positions ,if first position in the string
and a is same
it doesnot print any thing ,and check second position 2 element
in the string and p is not same then it will print p.like this way.
(or)
str_replace("is","was",$string);
it will replace was in the place of is in the string $string(****)
ereg_replace():-i am not understood this please verify once again.
*** strstr():-strstr($string,'needle');
examle:-strstr($string,'@');
it will return after the @
apparao_katra@yahoo.com--->o/p @yahoo.com
strtok():-it will return the words.
substr():-it will return the substring . we have to give the positions to retrieve the substring
example:-1) substr('abcdef',1);o/p bcdef
2) substr('abcdef',1,3);//o/p bcd
ucfirst($string):-it will change the first char is capital
ucwords($stirng):-it will change every word first char is capital
wordwrap():-wordwrap($text, 20,"<br>");
it return every 20 chars break.
strlen():-it will return the length of the string.
stristr(string,'char'):-it will return the from that char on wards.
$email = 'USER@EXAMPLE.com';
echo stristr($email, 'e');
// outputs ER@EXAMPLE.com
strrev(string):-it will return the string from back.
strtolower(string):-it will return the string into small case.
strtoupper(string):-ir will return the string into upper case.
//see string16.php ***********
strripos($string,$needle):-it will return the position of the needle
No comments:
Post a Comment