PHP Strings
Strings in PHP are sequences of characters. You can use single or double quotes to define them. PHP provides many built-in functions to manipulate strings.
PHP में strings characters का एक क्रम होता है। आप इन्हें single या double quotes में लिख सकते हैं। PHP में strings को manipulate करने के लिए कई built-in functions होते हैं।
Creating and Echoing a String
You can create a string by enclosing text in quotes.
आप quotes में text लिखकर string बना सकते हैं।
<?php
$str = "Hello World!";
echo $str;
?>
Hello World!
String Concatenation
Use the dot (.) operator to join two strings.
दो strings को जोड़ने के लिए dot (.) operator का उपयोग करें।
<?php
$first = "Hello";
$second = "World";
echo $first . " " . $second;
?>
Hello World
String Length (strlen)
strlen()
function returns the length of a string.
strlen()
function किसी string की लंबाई लौटाता है।
<?php
$text = "LiveCode";
echo strlen($text);
?>
8