PHP – Overview Syntax etc.pptx

PHP – Overview Syntax etc.pptx - PHP Syntax etc...

Info icon This preview shows pages 1–12. Sign up to view the full content.

View Full Document Right Arrow Icon
PHP – Syntax etc
Image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Arithmetic Operators
Image of page 2
Logical Operators
Image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Assignment Operators
Image of page 4
String Operators
Image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Comparison Operators
Image of page 6
Data Types String Integer Float (double) Boolean Array
Image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Variables $txt = "Hello world!"; $x = 5; $y = 10.5; Outputting variables: echo “The total of X is: “. $x;
Image of page 8
Echo or Print? Both statements can be used to output data Main difference – echo has no return value; print has a return value of 1 so can be used in expressions echo or echo() are both fine Print or print() will also work Can include html markup tags such as <br> or <h1> e.g. print "<h1>PHP is Fun!</h1>";
Image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Arrays $cars = array("Volvo", "BMW", "Toyota"); echo "I like " . $cars[0] . ", " . $cars[1] . " and " . $cars[2] . "."; $cars = array("Volvo", "BMW", "Toyota"); echo count($cars); This uses automatic assignment to create a numeric array This statement prints out each value in the array This count function will count how many values the array holds
Image of page 10
Arrays $cars = array("Volvo", "BMW", "Toyota"); sort($cars); $age = array("Peter"=>"35", "Ben"=>"37", "Joe"=>"43");
Image of page 11

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 12
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern