Saturday, December 13, 2014

Coding 2Day

My coding PHP Today (14/12/2014)....

1.'strlen' this is a function for count string in your php programming.
   like that... <?php echo strlen("Hasib"); ?>
   Here this function will count total string and print 5.
2. 'str_word_count' this function will count your word in your "" double cotaiton how word you have in your
   cotation? like that... <?php echo str_word_count("Hasib Kamal Chowdhury") ?>
   Here will be your output 3.
3. 'strrev' this function will reverse your string and print 'Kavi' as 'ivak'.
4. 'strpos' this function will represent your string position.
    Link that <?php echo strpos("Hasib Kamal", "l") ?>
    Here Out put will be 10. So how this output is 10? Just look back to the Code and count the position
    of  'l'.
5. 'str_replace' this php function will replace your defined word like that.
    Suppose there is "Hello World" and you want to replace world 'world' by 'Hasib'.
    So How can we do that?? So simple just see...
   <?php echo str_replace("World","Hasib","Hello World") ?>
    Here our string was "Hello World" and now we are replacing World by Hasib.
    At first we have chosen World and than We have entered the replacing word Hasib.
    that's it.....