Explore BrainMass

Explore BrainMass

    PHP script that defines two integers as constants

    This content was COPIED from BrainMass.com - View the original, and get the already-completed solution here!

    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.

    © BrainMass Inc. brainmass.com October 9, 2019, 11:28 pm ad1c9bdddf

    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.