AllInWorld99 provides a reference manual covering many aspects of web programming, including technologies such as HTML, XHTML, CSS, XML, JavaScript, PHP, ASP, SQL,FLASH, jQuery, java, for loop, switch case, if, if else, for...of, for...in, for...each,while loop, blogger tips, blogger meta tag generator, blogger tricks, blogger pagination, client side script, html code editor, javascript editor with instant output, css editor, online html editor, materialize css tutorial, materialize css dropdown list,break, continue statement, label,array, json, get day and month dropdown list using c# code, CSS button,protect cd or pendrive from virus, cordova, android example, html and css to make android app, html code play,telerik show hide column, Transparent image convertor, copy to clipboard using javascript without using any swf file, simple animation using css, SQL etc. AllInWorld99 presents thousands of code examples (accompanied with source code) which can be copied/downloaded independantly. By using the online editor provided,readers can edit the examples and execute the code experimentally.


     Php string function is used to do some action in strings, string is the set of characters. We have many string functions they are.

  • strlen()
  • strrev()
  • str_word_count()
  • strpos()
  • str_replace()

Find String Length in php

     strlen() function is used to get the total length of the given string.

Syntax for strlen()
strlen("string");
Example(Press Run to O/P):


String Reverse in php

     strrev() function is used to reverse the order of the string return that value.

Syntax for strrev()
strrev("String");
Example(Press Run to O/P):

Words count in php

     php str_word_count() is used to count the words in given sentence.

Syntax for str_word_count()
str_word_count ("sentence or string");

Example(Press Run to O/P):


Find string position

     strpos() is used to search a particular string or character and returns the position of the string.

Syntax for strpos
strpos ("string1","string2");
     compare string 2 with string1 and if it was matched return the index.
Example(Press Run to O/P):


Replace method in php

     str_replace() is used to replace the particular string with matched string

Syntax for str_replace
str_replace("string1","string2","string3");
     Compare the string1 with string3 and if it is matched, replace matched string3 strings to string2
Example(Press Run to O/P):


0 comments:

Post a Comment

Total Pageviews