Purchase Solution

PHP script that defines two integers as constants

Not what you're looking for?

Ask Custom Question

I need some major help here. I have never written a PHP script where the values did not come from a form. So I am asking for some assistance in providing me with an example. I am not sure how many credits to post, so I am going to start out with 5. If you need more, let me know. The reason I am asking for an example is with specific requirements is because then I can look at the example and see how it works. The example I am asking for has to have the following.

Write a script that defines two integers as constants.
For instance, one of the constants could be the distance from New York City to Los Angeles.

Using arithmetic operators, write five expressions that:
1) Add the two operands
2) Subtract one operand from the other
3) Multiply the two operands
4) Divide one operand by the other and
5) Divide one operand by the other and return the remainder.

Next, take a result value from one of the previous arithmetic expressions and use an increment operator to increase its value by 1.

Next, use five comparison operators of your choice to determine how the operands and results compare to one another.

Finally, display the full path and filename of your file using a magic constant on the bottom of your web page.

Purchase this Solution

Solution Summary

To define constants, use the define() function. To print out the value of a variable or constant, use the echo() function. The solution combines these and other PHP operators together and provides an actual PHP file that satisfies the requirements of the problem. Comments are placed throughout the code so that you can better understand what the code is for.

Purchase this Solution


Free BrainMass Quizzes
Word 2010: Tables

Have you never worked with Tables in Word 2010? Maybe it has been a while since you have used a Table in Word and you need to brush up on your skills. Several keywords and popular options are discussed as you go through this quiz.

Inserting and deleting in a linked list

This quiz tests your understanding of how to insert and delete elements in a linked list. Understanding of the use of linked lists, and the related performance aspects, is an important fundamental skill of computer science data structures.

Basic Computer Terms

We use many basic terms like bit, pixel in our usual conversations about computers. Are we aware of what these mean? This little quiz is an attempt towards discovering that.

Basic Networking Questions

This quiz consists of some basic networking questions.

Excel Introductory Quiz

This quiz tests your knowledge of basics of MS-Excel.