PHP Theory
Strings in PHP:
A string is a combination of characters. String is one of the data types maintained by PHP.
PHP String functions:
Strlen() function :
This function is used to find the length of a given string.
Example |
---|
<?php echo strlen("SkillPundit"); //Output : 11 ?> |
Str_word_count() function:
This function is used to count the number of words present in a given string.
Example |
---|
<?php echo str_word_count("Hello SkillPundit"); //Output : 2 ?> |
Strrev() function:
This function is used to reverse a given string.
Example |
---|
<?php echo strrev("SkillPundit"); //Output : tidnuPllikS ?> |
//Output() function:
This function is used to convert the given string characters into lower case letters.
Example |
---|
<?php echo strtolower("SKILLPUNDIT"); //Output : skillpundit ?> |
Strtoupper() function:
This function is used to convert the given string characters into upper case letters.
Example |
---|
<?php echo strtoupper("skillpundit"); //Output : SKILLPUNDIT ?> { https://www.javatpoint.com/php-string-functions https://www.guru99.com/php-strings.html } |