Question: 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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!