1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
|
<?php
function foo($a, $b) {
return $a * 2;
}
function baz($a, $b) {
echo "baz({$a});";
}
function bar($a, $b) {
$x = $b;
for ($i = 0; $i <$a; $i++) {
$x += $a * $i;
}
return $x;
}
function foobar($a, &$b) {
return (preg_match('/foo/', $a, $b) !== 0);
}
class Foo {
function barfoo($a, $b) {
// Empty body means interface method in many cases.
}
function fooBar($a, $b) {
return;
}
}
function foo($bar)
{
print <<<BAZ
$bar
BAZ
}
function foo( $parameter ) {
$wango = <<<HERE
1 Must be a HEREdoc of at least one line
HERE;
$x = $parameter; // This line must be immediately after the HERE; with no intervening blank lines.
$tango = <<<HERE
1 Must be a HEREdoc
2
3
4
5
6
7
8
9 at least 9 lines long
HERE;
}
function foo( $parameter ) {
return <<<HTML
<?xml version="1.0"?>
<value>$parameter</value>
HTML;
}
print foo( 'PARAMETER' );
print "\n";
|