String Operations PHP

String Operations PHP

15CSL77
WEB TECHNOLOGY LABORATORY WITH MINI PROJECT


program

Write a PHP program that declares a variable states with a value "Mississippi Alabama Texas Massachusetts Kansas". write a PHP program that does the following: 
  1.  Search for a word in variable states that end in xas. Store this word in element 0 of a list named statesList.
  2.  Search for a word in states that begins with k and ends in s. Perform a case insensitive comparison. [Note: Passing re. Ias a second parameter to method compile performs a case-insensitive comparison.] Store this word in element1 of statesList.
  3. Search for a word in states that begins with M and ends in s. Store this word in element 2 of the list. d. Search for a word in states that ends in a. Store this word in element 3 of the list.

Basic Concepts

  1. The explode() function breaks a string into an array.
  2. preg_match – this function is used to perform a pattern match on a string.

code


output

String Operations PHP
search from string

String Operations PHP Video Tutorial


1 comment:

For Query and doubts!

Powered by Blogger.