PHP String

Back to ACP page

Table of Contents

PHP String

<h4>string</h4> <p>From w3schools.com, Experiment by Teeratus_R </p> <?php echo "Hello"; echo 'Hello'; ?>

Example 1

Result View Example

PHP Double or Single Quotes

<h4>Double_or_Single_Quotes</h4> <p>From w3schools.com, Experiment by Teeratus_R </p> <hr> <p>Double quoted string literals perform operations for special characters:</p> <?php $x = "John"; echo "Hello $x"; ?> <hr> <p>Single quoted string literals returns the string as it is:</p> <?php $x = "John"; echo 'Hello $x'; ?>

Example 2

Result [View Example](ex2-Double or Single Quotes/index.php)

PHP String Length

<h4>String Length</h4> <p>From w3schools.com, Experiment by Teeratus_R </p> <?php echo strlen("Hello world!"); ?>

Example 3

Result View Example

PHP Word Count

<h4>Word Count</h4> <p>From w3schools.com, Experiment by Teeratus_R </p> <p>Word Count</p> <?php echo str_word_count("Hello world!"); ?>

Example 4

Result View Example

PHP Search For Text Within a String

<h2>Search For Text Within a String</h2> <p>From w3schools.com, Experiment by Teeratus_R </p> <p>Search_For_Text_Within_a_String</p> <?php echo strpos("Hello world!", "world"); ?>

Example 5

Result [View Example](ex5-Search For Text Within a String/index.php)

Document

Document in project

You can Download PDF file.

Reference