Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

Section A.4. 

A.4. Chapter 4


Solution to Question 4-1

Code that performs a task.


Solution to Question 4-2

An operator.


Solution to Question 4-3

An operator combines simple expressions into more complex expressions. It does so by creating relationships between the simple expressions that can then be evaluated.


Solution to Question 4-4

An operator.


Solution to Question 4-5

An operator that combines two expressions into a more complex single expression.


Solution to Question 4-6

An operator that takes three operands.


Solution to Question 4-7

No—they take only numbers.


Solution to Question 4-8

It's an array, integer, or string.


Solution to Question 4-9

Yes—you'll end up with the wrong operator.


Solution to Question 4-10

It checks whether a variable is set.


Solution to Question 4-11

The switch statement is written as follows:

switch ($action) {
  case "add":
    $x = $x+y;
    break;
  case "subtract":
    $x = $x-y;
    break;
  case "multiply":
    $x = $x*$y;
    break;
  case "divide":
    $x = $x/$y;
    break;
}


Solution to Question 4-12

It tells PHP not to execute cases other than the matching case.


Solution to Question 4-13

The loop is written as follows:

<?php
for ($num = 10; $num >= 1; $num&#8722;&#8722;) {
    print "$num<br>";
}
?>


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint