Beginner guide of PHP Strings

A string is arrangement of characters, where a character is equivalent to a byte. This implies PHP just supports a 256-character set, and subsequently doesn’t offer local Unicode support.

String has four different ways written as :-

1.) Single quoted (/)
2.) Double quoted (“)
3.) Heredoc Syntax (<<<)
4.) Nowdoc syntax (<<<)

1.)Single quoted (/):-

Single quoted strings are the most straightforward approach to indicate string. Single quote is utilized to indicate string when we need the string to be actually as it is composed.

2.)Double quote (“):-

Double quote strings will show a large group of got away characters , and variables in the strings will be assessed. A significant point here is that you can use curly braces to isolate the name of the variable you want evaluated.

3.)heredoc (<<<):-

Heredoc for multi-line strings that require formatting and variable interpolation.

4.) Nowdoc syntax (<<<):-

Nowdocs are to single-quoted strings what heredocs are to twofold quoted strings. A nowdoc is indicated similarly to a heredoc, yet no parsing is done inside a nowdoc. The develop is perfect for implanting PHP code or other huge squares of content without the requirement for getting away. It imparts a few highlights in like manner to the SGML build, in that it announces a square of content which isn’t for parsing. It symbol similar to heredoc but identifier which follows is inclosed.

Print function:-

Utilizing this function we can show the outputs in the program. This capacity restores the Boolean worth genuine. We can’t print the different articulations utilizing this capacity. The print capacity assumes a similar job as the echo function.

String functions:-

strtolower, strtoupper, strlen, strpos,
str_replace, substr, str_split

Strtolower:-

Strtolower() is a function that can be used to convert to use lowercase string. strtolower function takes string as parameter and converts all the uppercase english alphabets persent in the string to lowercase. All numeric characters or all special characters in string renames that unchanged.

Strtoupper:-

Strtoupper() is a function tha can be used to convert to use uppercase string. Strtoupper function takes string as parameter and converts all the lowercase english alphabets persent in the string to upercase. All numeric characters or all special characters in string renames that unchanged.

Strlen:-

Strlen() is a function in PHP which returns given string lenth. Strlen takes a string returns its lenght as a parameter. It calculates string of length.

Strpos:-

Strpos() in this function in PHP returns a value Zero(0). which is in this given string.

str_replace:-

Rajesh Kumar
Follow me