Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Answer in PHP I will give a thumbs up and positive comment for a complete response! thank you!

Answer in PHP

$haystack = "

"; $needle = "method"; //1. print the position of the $needle in $haystack (answer will be 27)

$needle = "method="; //2. print the first position that is AFTER the $needle in $haystack (answer will be 34)

//3. using string functions print the actual method in $haystack. (Your code //should print post) //ASSUME THAT YOU KNOW THAT $haystack IS A FORM TAG THAT HAS A METHOD ATTRIBUTE //with no spaces between the = sign. //DO NOT MANUALLY COUNT TO THE SPOT TO FIND post.

//let us look at a DNA example $haystack = "ACAAGACACATGCCACATTGTCC"; $needle = "ACA";

//4. print out the number of times $needle //occurs (nonoverlapping) in haystack //TT occurs once in TTT! (answer is 3) hint: look up substr_count in php.net

//5. Print out the number of time $needle occurs in //$haystack. Count overlapping examples as well! (answer will be 4) //so TT occurs two times in TTT, for example!

$subject = "Cloud computing works!";

//6. Print out the $subject with //all letter 'o' replaced with the letter 'e'

$subject = "Keep your spacing perfect!"; //7. print out $subject where replace any two //spaces in a row ' ' with a - and // any single space ' ' with a * //so the example above prints //Keep*your--spacing-*perfect!";

$string = "red orange yellow green blue indigo violet";

//8. create an array that has the colors of the above string //in reverse order (so $colors[0] is 'violet') //Hint: look up the explode function. You might need the array_reverse function

//9. Print out the newly created array in the new order using //foreach, with each word captialized

?>

I will give a thumbs up and positive comment for a complete response! thank you!

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Case Studies In Business Data Bases

Authors: James Bradley

1st Edition

0030141346, 978-0030141348

More Books

Students also viewed these Databases questions

Question

Answer in PHP

Answered: 1 week ago