Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

/**

* 9 PHP functions requiring functions, assert, selection, repetition, and arrays,

* The code has a few asserts and some output, which you may delete when done.

* Write more asserts to test your code. We will have many more asserts when grading.

* It is important for you to learn how to test your code.

*

* Programmer: YOUR NAME

*/

// 1) howSwedish

// ABBA is a band, they have many songs including Dancing Queen, and

// Fernando. ABBA is actually a Swedish band, so if we wanted to find

// out howSwedish a String is, we could simply find out how many times

// the String contains the substring "abba". We want to look for this

// substring in a case insensitive manner. So "abba" counts, and so

// does "aBbA". We also want to check for overlapping abba's such as

// in the String "abbAbba" that contains "abba" twice.

//

// howSwedish("ABBA a b b a") returns 1

// howSwedish("abbabba!") returns 2

function howSwedish($str) {

}

echo ' howSwedish(abbabba) 2: ' . howSwedish ( 'abbabba' ) . " ";

assert ( 2 == howSwedish ( 'abbabba' ) );

echo 'howSwedish(ABBA a b b a) 1: ' . howSwedish ( "ABBA a b b a" ) . " ";

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

Fundamentals Of Database System

Authors: Elmasri Ramez And Navathe Shamkant

7th Edition

978-9332582705

More Books

Students also viewed these Databases questions

Question

1. Who will you assemble on the team?

Answered: 1 week ago

Question

Did the team members feel that their work mattered

Answered: 1 week ago