Jump to content

Code help from man Example 17-8


fluidsharp

Recommended Posts

Hello!

Please tell what does it mean, and how it works:  $device = is_null($coffeeMaker) ? "hands" : $coffeeMaker;

What do mean "?" and ":" there? It is regular expression?

 

 

<?php

function makecoffee($types = array("cappuccino"), $coffeeMaker = NULL)

{

    $device = is_null($coffeeMaker) ? "hands" : $coffeeMaker;

    return "Making a cup of ".join(", ", $types)." with $device.\n";

}

echo makecoffee();

echo makecoffee(array("cappuccino", "lavazza"), "teapot");

?>

Link to comment
https://forums.phpfreaks.com/topic/187785-code-help-from-man-example-17-8/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.