return $ret; } $q = $_GET["q"]; $type = $_GET["type"]; // If a group is asked instead of an item, change to group page if ($type == 'item' && substr($q, 0, 6) == 'group:') { $type == 'group'; $q = substr($q, 7); } $starttime = new DateTime(); echo '<head> <link rel="stylesheet" type="text/css" href="main.css"> </head> <body>'; switch ($type) { case 'item': echo render_item_page($q); break; case 'group': echo render_group_page($q); break; case 'test': echo mytest(); break; default: echo render_item_index(); } $endtime = new DateTime(); $diff = $starttime->diff($endtime); echo "Elapsed time " . $diff->format('%H:%I:%S'); echo '</body>';
<body> <?php //Define define("GREETING", "Welcome to My World!", "false"); //define(name, value, case-insensitive) echo GREETING; echo "<br>"; echo greeting; //Global constant are global echo "<br>"; function mytest() { echo GREETING; } mytest(); // calling fuinction mytest echo "<br><br>"; echo "String Concatenation <br>"; $sa = "Hello"; $sb = "world"; echo $sa . $sb; echo "<br><br>"; $x = 100; $y = 50; if ($x == 100 || $y == 80) { echo "Hello world!"; } echo "<br><br>"; $x = array("a" => "red", "b" => "green"); $y = array("c" => "blue", "d" => "yellow");