function Router($action) { switch ($action['type']) { case 'HELLO_WORLD': return helloWorld($action); case 'ADD_TODO': return addTodo($action); case 'LIST_TODO': return listTodo($action); case 'DELETE_TODO': return deleteTodo($action); case 'COMPLETE_TODO': return completeTodo($action); default: return $action; } }
public function testAnotherSampleName() { $this->assertEquals('Hello, Bob!', helloWorld('Bob')); }
<?php function helloWorld($count) { $answer = ""; //Define empty string. $total = 0; for ($i = 0; $i < $count; $i++) { $answer .= "HELLO WORLD\n"; } return $answer; //echo prints out final result } echo helloWorld(5);
<?php require 'test.php'; ?> <html> <head><title>Hello World!</title></head> <body> <h1><?php print helloWorld(); ?> </h1> <p>Click <a href="/info.php">here to view PHP information</a></p> <p>Static resource test</p> <img src="technical-difficulties1.jpg" alt="technical difficulties" /> <p>Property Test: <?php print array_key_exists('test', $_GET) ? $_GET['test'] : 'None'; ?> </p> </body> </html>
<?php /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ echo "Testing helloWorld in skeleton.so\n"; echo helloWorld('Taylor'); echo helloWorld(1234 + 5678); echo helloWorld(['string', 123 + 456]); // echo "================\n"; $a = 10; $b = 20; // swap($a); causes a segment fault swap($a, $b); echo $a . "|" . $b . "\n"; $c = 10; $d = "string"; swap($c, $d); echo $c . "|" . $d . "\n"; $e = 10; $f = new \DateTime(); swap($e, $f); var_dump($e); var_dump($f); echo "================\n"; class sampleClass { var $i;
<?php $funs = array('helloWorld', 'helloWorld2', 'helloWorld3', 'helloWorld4'); $refStr = ""; foreach ($funs as $fun) { $ref = new ReflectionFunction($fun); $refStr .= $ref . "\n"; } echo $refStr; function helloWorld5($name, $flag) { if (!$flag) { return null; } return "Hello World!!!elf and hello to " . $name . ", lol"; } var_dump(helloWorld("Froscon", true)); var_dump(helloWorld2("Froscon", true)); var_dump(helloWorld3("Froscon", true)); var_dump(helloWorld4("Froscon", false)); var_dump(helloWorld4("Froscon", true)); var_dump(helloWorld5("Froscon", false)); var_dump(helloWorld5("Froscon", true)); var_dump(helloWorld6(false)); var_dump(helloWorld6(true));
<?php namespace PmbaTestPackage; function helloWorld() { return "Hello World!"; } helloWorld();
<? // assertEcho 'hello world' function helloWorld() { return 'hello world'; } echo helloWorld(); ?>
<?php print "Include Path: " . get_include_path() . "\n"; require "test.php"; print "Hello World!!!\n"; print helloWorld() . "\n";