function foo($bla) { $array = array('key' => 'value', 'anotherKey' => 'anotherValue'); echo 'foo'; foo::foo($param1, $param2); $this->foo($param3, $param4); somefunc($param5, $param6); }
<?php if ($something || !($test = somefunc())) { echo "yay?"; }
if ((string) "123" < (string) "0124") { echo '(string)"123" < (string)"0124"'; } echo "<hr>"; $arg = 1; $num = $arg == 1 ? 'one' : $arg == 2 ? 'two' : 'some other value'; echo $num; // prints two echo "<hr>"; $num = $arg == 1 ? 'one' : ($arg == 2 ? 'two' : 'some other value'); echo $num; // prints one echo "<hr>"; function someFunc() { echo "calling someFunc()"; } somefunc(); // function names are case insensitive $myVar = 12; echo $myvar; // error. variable names are case sensitive echo "<hr>"; $first = array("a" => 123, "b" => 456); $second = array("c" => 456, "d" => 123); var_dump(array_diff($first, $second)); // array(0) {} echo "<hr>"; var_dump(array_diff_assoc($first, $second)); // array(2) { ["a"]=> int(123) ["b"]=> int(456) } echo "<hr>";
$jj = array(); for ($i = 0; $i <= $q; $i++) { array_push($ii, $i); } for ($i = $q + 1; $i < $K; $i++) { array_push($jj, $i); } ldiv($ii, $jj); echo "<br/>"; foreach ($P as $p) { print_r($p); echo "<br/>"; } $val = 0; do { $val = somefunc(); var_dump($val); } while ($val > 1); if ($val == 1) { $d1 = 0; for ($i = 0; $i < $K; $i++) { if ($P["d"][$i] < $l) { $d1 = $i; } } $arr = array(); for ($i = 0; $i < $K; $i++) { //CLOSEST CLUSTER if ($P["d"][$i] >= $l) { mysql_query("insert into clus" . $P["i"][$i] . " select * from clus" . $P["i"][$d1]); mysql_query("drop table clus" . $P["i"][$d1]);
<?php require "tests.php"; require "typedef_reference.php"; check::functions(array(somefunc, otherfunc, new_intp, copy_intp, delete_intp, intp_assign, intp_value)); $int2 = copy_intp(2); check::equal(2, somefunc($int2), " test passing intp to somefunc"); $int3 = copy_intp(3); check::equal(3, otherfunc($int3), " test passing intp to otherfunc"); check::done();
<?php $var = (int) "12"; $var = (array) somefunc();
[expect php] [file] <?php $bar = 1; $arr[somefunc($bar)] = 'èauky'; echo $arr[somefunc($bar)]; function somefunc($a) { return $a . "func"; }