PHP String Functions In Hindi

📔 : PHP 🔗

PHP हमें कई सारे String functions provide कराती है जिनकी help से हम String manipulate  और बहुत से Operations perform कर सकते हैं।  कुछ String functions इस प्रकार हैं -


Function Name Uses
strlen()
return string length (nothing returns for empty string ).
is_string()
checks and return true if given variable is a string.
strpos()
find the position of first matched substring.
strtolower()
coverts a string in lowercase.
strtoupper()
converts a string in uppercase.
substr()
returns the sub string  according to given arguments .
ucwords()
converts first character upper case of each  words of given string.
ucfirst()
converts  first character upper case of given string .
lcfirst()
converts  first character lowercase of given string.
trim()
removes white space from both sides (beginning and end) of given string.
rtrim()
removes white space from right side (from the end ) of given string.
ltrim()
removes white space from left side (from the beginning) of given string..
print()
output of string and return 1 (True).
echo()
output of string.
strrev()
returns reverse string .
implode()
converts an array in to string according to given glue (a symble or character that separates each array value).

PHP String Function Examples

File : string_function.php

CopyFullscreenClose Fullscreen
<?php
    $str = "Hello everyone! Welcome to learnhindituts.com Now learn in hindi.";
    
    echo 'length of $str is : '.strlen($str);
    /* for line break */
    echo '<br>';
    
    echo 'postion of `welcome` is : '. strpos($str, "Welcome");
    echo '<br>';
    
    echo 'convert given string into lower case : '.strtolower($str);
    echo '<br>';
    
    echo 'convert given string into UPPER CASE : '.strtoupper($str);
    echo '<br>';
    
    echo 'sub string from index 16 to 29 : '.substr($str, 16, 29);
    echo '<br>';

    echo 'use of ucwords : '.ucwords($str);
    echo '<br>';
    
    echo 'converts only first character upper case of given string : '.ucfirst($str);
    echo '<br>';

    echo 'reverse the given string : '.strrev($str);
?>
Output
length of $str is : 65
postion of `welcome` is : 16
convert given string into lower case : hello everyone! welcome to learnhindituts.com now learn in hindi.
convert given string into UPPER CASE : HELLO EVERYONE! WELCOME TO LEARNHINDITUTS.COM NOW LEARN IN HINDI.
sub string from index 16 to 29 : Welcome to learnhindituts.com
use of ucwords : Hello Everyone! Welcome To Learnhindituts.com Now Learn In Hindi.
converts only first character upper case of given string : Hello everyone! Welcome to learnhindituts.com Now learn in hindi.
reverse the given string : .idnih ni nrael woN moc.stutidnihnrael ot emocleW !enoyreve olleH

Related Topics :

Rahul Kumar

Rahul Kumar

Hi ! I'm Rahul Kumar Rajput founder of learnhindituts.com. I'm a software developer having more than 4 years of experience. I love to talk about programming as well as writing technical tutorials and blogs that can help to others. I'm here to help you navigate the coding cosmos and turn your ideas into reality, keep coding, keep learning :)

Get connected with me. :) LinkedIn Twitter Instagram Facebook

b2eprogrammers