17
PHP Basics II CBIS 4210

PHP Basics II - bryanmarshall.com · PHP Basics II CBIS 4210. Quiz 2 •This quiz is on D2L. Please take it quickly. When you are finished, bring up your composition book to be checked

  • Upload
    others

  • View
    2

  • Download
    0

Embed Size (px)

Citation preview

Page 1: PHP Basics II - bryanmarshall.com · PHP Basics II CBIS 4210. Quiz 2 •This quiz is on D2L. Please take it quickly. When you are finished, bring up your composition book to be checked

PHP Basics IICBIS 4210

Page 2: PHP Basics II - bryanmarshall.com · PHP Basics II CBIS 4210. Quiz 2 •This quiz is on D2L. Please take it quickly. When you are finished, bring up your composition book to be checked

Quiz 2

• This quiz is on D2L. Please take it quickly. When you are finished, bring up your composition book to be checked off today.

Page 3: PHP Basics II - bryanmarshall.com · PHP Basics II CBIS 4210. Quiz 2 •This quiz is on D2L. Please take it quickly. When you are finished, bring up your composition book to be checked

Helix

1. How do you login?

2. How do you make a new project and repository?

3. How do you push your code to the repository?

4. How do you turn in your code?

Page 4: PHP Basics II - bryanmarshall.com · PHP Basics II CBIS 4210. Quiz 2 •This quiz is on D2L. Please take it quickly. When you are finished, bring up your composition book to be checked

PHP Arithmetic Operators

Page 5: PHP Basics II - bryanmarshall.com · PHP Basics II CBIS 4210. Quiz 2 •This quiz is on D2L. Please take it quickly. When you are finished, bring up your composition book to be checked

PHP Math Functions

• https://www.w3schools.com/Php/php_ref_math.asp

Page 6: PHP Basics II - bryanmarshall.com · PHP Basics II CBIS 4210. Quiz 2 •This quiz is on D2L. Please take it quickly. When you are finished, bring up your composition book to be checked

PHP Assignment Operators

Page 7: PHP Basics II - bryanmarshall.com · PHP Basics II CBIS 4210. Quiz 2 •This quiz is on D2L. Please take it quickly. When you are finished, bring up your composition book to be checked

PHP Comparison Operators

Page 8: PHP Basics II - bryanmarshall.com · PHP Basics II CBIS 4210. Quiz 2 •This quiz is on D2L. Please take it quickly. When you are finished, bring up your composition book to be checked

PHP String Operators

Page 9: PHP Basics II - bryanmarshall.com · PHP Basics II CBIS 4210. Quiz 2 •This quiz is on D2L. Please take it quickly. When you are finished, bring up your composition book to be checked

PHP Logical Operators

Page 10: PHP Basics II - bryanmarshall.com · PHP Basics II CBIS 4210. Quiz 2 •This quiz is on D2L. Please take it quickly. When you are finished, bring up your composition book to be checked

Get the Length of a String

Page 11: PHP Basics II - bryanmarshall.com · PHP Basics II CBIS 4210. Quiz 2 •This quiz is on D2L. Please take it quickly. When you are finished, bring up your composition book to be checked

Count the Number of Words in a String

Page 12: PHP Basics II - bryanmarshall.com · PHP Basics II CBIS 4210. Quiz 2 •This quiz is on D2L. Please take it quickly. When you are finished, bring up your composition book to be checked

Reverse a String

Page 13: PHP Basics II - bryanmarshall.com · PHP Basics II CBIS 4210. Quiz 2 •This quiz is on D2L. Please take it quickly. When you are finished, bring up your composition book to be checked

Replace Text Within a String

Page 14: PHP Basics II - bryanmarshall.com · PHP Basics II CBIS 4210. Quiz 2 •This quiz is on D2L. Please take it quickly. When you are finished, bring up your composition book to be checked

Manipulating Strings

// use this to count the number of characters

strlen($variable)

// use this to trim any spaces off front or back of input

trim($variable)

if (strlen(trim($_POST[‘zipcode’])) != 5) {

echo “Please enter a zip code that is 5 digits long”;

}

Page 15: PHP Basics II - bryanmarshall.com · PHP Basics II CBIS 4210. Quiz 2 •This quiz is on D2L. Please take it quickly. When you are finished, bring up your composition book to be checked

Changing Case

//upper case the first letter of each word

ucwords($var1)

//lower case the whole word

strtolower($var1)

Page 16: PHP Basics II - bryanmarshall.com · PHP Basics II CBIS 4210. Quiz 2 •This quiz is on D2L. Please take it quickly. When you are finished, bring up your composition book to be checked

All the Functions

• https://www.w3schools.com/Php/php_ref_string.asp

Page 17: PHP Basics II - bryanmarshall.com · PHP Basics II CBIS 4210. Quiz 2 •This quiz is on D2L. Please take it quickly. When you are finished, bring up your composition book to be checked

Inclass• Write a PHP program that computes the total cost of this restaurant meal:

two hamburgers @ $4.95 eachone chocolate milkshake @ $1.95one litter of cola @ .85

• Sales tax is 7.5%

• You left a pre-tax tip of 16%

Now format this as a bill.

• For each item, print the price, quantity and total costs.

• Print the pre-tax food and drink total, the post-tax total, and the total with tax and tip.