Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask PHP Expert

1. Write a script that prints out the following text to the screen exactly as shown:

"Hey", he said, "You still owe me \‘$5'\ from \\\ that $50 I lent "last week"".

2. Write a script that uses a loop to write the values 1 to 1000, one value per line. Inside the loop skip printing number 250, and determine if the next number to be written is 500. If it is, stop the loop.

3. Write a PHP script that uses an array called $array to store the values of firstname and lastname that are sent by the following form.


First name:
Last name:

Write the code to add those values from the form to the end of the $array array. Then use a foreach loop to print out the values from $array.

4. Write a PHP script that opens a text file called "lesson04.txt" for appending (or creates it if it does not yet exist); if there is a problem opening/creating the file, terminate the PHP script. Write the text "\nCOMP2920 will be fun\n" to the text file, and close the file.

5. Write a regular expression that matches only the following:

A street address that has the following pattern (in the following order):

An optional # sign                                                                                   e.g. "#"

1 to 5 digits (optional - apartment number)                                               e.g. "100"

an optional dash, which has an optional space on either side of it                e.g. " - "

1 to 5 digits (street number)                                                                    e.g. "7777"

"th" or "st" or "nd" or "rd" (optional)                                                         e.g. "th"

At least one space                                                                                  e.g. " "

"Street" or "street" or "Avenue" or "avenue" or "Ave" or "ave"                   e.g. "Street"

Examples that meet the criteria:
"#100 - 7777th Street"
"100-7777 ave"

Examples that do not meet the criteria:
"abc100 - 7777 ave"
"100-7777 ave XYZ"

$regex = "

6. Write a PHP script that says "Welcome back" to the user if they have visited the site in the past 10 minutes. If the user has NOT visited in the past 10 minutes, tell them "Welcome to my Web site" and store a cookie that will remember them for 10 minutes. Use a cookie called "tenminutes".

7. Write a script that checks for the existence of a session variable called "lastname". If the variable does not exist, tell the user "farewell" and terminate the script. If the variable does exist, print its value to the screen and create a session variable called "logged", and set its value to true. Write all of the code necessary to make the script work.

8. It is not easy to test graphics without using a reference guide. Instead, describe your favourite and least favourite parts of this course. Any thoughtful reply will earn top marks. Incomplete or unhelpful comments can earn zero marks.

9. I have created a database account on a host called "blah.com". You can connect to the host with username "tony" and password "comp1920".

The database is called "information". There is a table in this database called "names" with the following fields:
- firstname varchar(40)
- lastname varchar(40)
- middlename varchar(40)
- nickname varchar(40)
- username varchar(40)

Write a PHP script that connects to the database server, or dies if it cannot connect. Select the "information" database. Insert a record into the database.

10. Continuing from question 9 (do not repeat that code here), write a script to list all of the records in the "names" table of the "information" database, sorted by nickname.

11. Your instructor likes to learn new things, too.

What is the meaning of life? Tell your instructor anything that makes him *think*. Any attempt at an honest answer will score full marks. Your instructor has learned lots of interesting things from students.

PHP , Programming

  • Category:- PHP
  • Reference No.:- M91570410
  • Price:- $50

Priced at Now at $50, Verified Solution

Have any Question?


Related Questions in PHP

In php write a simple addtion calculator that reads in two

In PHP write a simple addtion calculator that reads in two values and then add them together and display the output. Be sure to validate both inputs and ensure that it can add 0+0 = Sum: 0. The user should be able to inp ...

Final project assignment -requirements specifications -1

FINAL PROJECT ASSIGNMENT - REQUIREMENTS / SPECIFICATIONS - 1. For the final project, you will have to make good use of your CMS using PHP and MySQL for the content delivery. You will have to be able to deliver the conten ...

Question continue to build on the skills of providing web

Question: Continue to build on the skills of providing Web page content and structure with HTML and Web page style and layout using CSS. Demonstrate the skill of creating a dynamic Web page that includes JavaScript clien ...

Question using the course software and week one template as

Question: Using the course software and Week One Template as a starting point, create a new HTML webpage and include the following: • Write the code to display your name in the largest-size heading element. • Write the m ...

Question develop a 5-6 page word document that describes

Question: Develop a 5-6 page Word document that describes the design for a small Web site that meets the following specifications. 1. The Web site includes four or more Web pages designed according to current usability g ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As