Write a PHP script in html that creates a variable $states with the value "Mississippi Alabama Texas Massachusetts Kansas". The script should perform the following tasks: a. Search for a word in $states that ends in xas. Store this word in element 0 of an array named $statesArray. b. Search for a word in $states that begins with k and ends in s. Perform a case-insensitive comparison. Store this word in element 1 of $statesArray. c. Search for a word in $states that begins with M and ends in s. Store this element in element 2 of the array. d. Search for a word in $states that ends in a. Store this word in element 3 of the array. e. Output the array $statesArray to the screen.
Write a PHP script in html that creates a variable $states with the value "Mississippi Alabama Texas Massachusetts Kansas". The script should perform the following tasks:
a. Search for a word in $states that ends in xas. Store this word in element 0 of an array named $statesArray.
b. Search for a word in $states that begins with k and ends in s. Perform a case-insensitive comparison. Store this word in element 1 of $statesArray.
c. Search for a word in $states that begins with M and ends in s. Store this element in element 2 of the array.
d. Search for a word in $states that ends in a. Store this word in element 3 of the array.
e. Output the array $statesArray to the screen.
![](/static/compass_v2/shared-icons/check-mark.png)
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
![EBK JAVA PROGRAMMING](https://www.bartleby.com/isbn_cover_images/9781337671385/9781337671385_smallCoverImage.jpg)
![EBK JAVA PROGRAMMING](https://www.bartleby.com/isbn_cover_images/9781337671385/9781337671385_smallCoverImage.jpg)