Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Answer in PHP please! I will thumbs up and positive comment a complete response! Thank you!

Answer in PHP please!
I will thumbs up and positive comment a complete response! Thank you!
//Use string functions for all the examples!
//Complete the code and run it. All output should
//be numbered with the question, and skip lines
//in the output between questions.
// Post your completed
//code to BB (attach a php file),
//and put the URL into the comments section on BB
//BRING QUESTIONS ON THIS TO CLASS!
$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
?>

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

Successful Keyword Searching Initiating Research On Popular Topics Using Electronic Databases

Authors: Randall MacDonald, Susan MacDonald

1st Edition

0313306761, 978-0313306761

More Books

Students also viewed these Databases questions

Question

1. What is the meaning and definition of banks ?

Answered: 1 week ago

Question

2. What is the meaning and definition of Banking?

Answered: 1 week ago

Question

3.What are the Importance / Role of Bank in Business?

Answered: 1 week ago