Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

4. Suppose that Sname contains a last name followed by a comma and a space, followed by a first name. Then, you can store the

image text in transcribed
4. Suppose that Sname contains a last name followed by a comma and a space, followed by a first name. Then, you can store the first and last names in variables with code like this: a. $strpos (Sname, . Sfirst nane substr (Sname, 0, i) $last name substr (Sname, $i+1) Stirst name substr (Sname, 0, $i): last name subatr (Sname, $+2) c. $i strpos($name, Slast name aubstr ($name, 0, $i) Sfirst nane substr (Sname, $1+1) d. $1 strpos (Sname, , ' $1ast name-substr (Sname, 0, $i): Stirst_name subatr (Sname, i+2) 5. If you want to generate a random number that ranges from 1000 to 500,000 as a multiple of 100 (1000, 1100, 1200, etc.), and store it in a variable named Snumber, you can use the code that follows. a. 9aumber at_rand (1000, s00000): b. Snumber mt rand (100, 50000) c. $number nt rand (1,50o): d. $number - at rand (10,5000) Snumber10 Snumber1000; Snumber100 Code example 1 Scurrent date new DateTineO : $due-days-diff = $current date-diff ($due if (saurrent_date > Sdue date) date); Soverdue nessageSdue days _diff->fornat( y years, mmonths,and id days overdue.' 6. (Refer to code example 1) If Sdue_date contains a Date Time object, Sdue_date_diff will contain a. a TimeStamp object b. a DateTime object c. a Datelnterval object d. a Timelnterval object 7. (Refer to code example 7) If Sdue_date contains a Date Time object for a date that comes 1 month and 7 days before the date stored in the Scurrent date variable, what will Soverdue_message contain when this code finishes executing: a. 0 years, 1 months, and 7 days overdue. b. -0 years, -1 months, and -7 days overdue. c. 1 month and 7 days overdue. d. Soverdue_message won't be set because the if clause won't be executed 8. Suppose an array of country codes and country names is created with a statement like this: $country_codes - array (DEo'Germany, ARGArgentina'USAOnited States) If you want to use echo statements to display a table of all of the codes and names, you could code those statements within a loop that starts like this: a. foreach (scountry_codes as Snane [oodo]) b. foreach (Scountry_codes as Soode $name) ( c. for (soountry_codes as Sname [oode]) t d. for (Scountry_codes as $code Sname)

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_2

Step: 3

blur-text-image_3

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

Main Memory Database Systems

Authors: Frans Faerber, Alfons Kemper, Per-Åke Alfons

1st Edition

1680833243, 978-1680833249

More Books

Students also viewed these Databases questions

Question

=+ (b) Shows that Q agrees with P on Fo.

Answered: 1 week ago