forked from engineerOfLies/rabbitmqphp_example
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtestphp.php
executable file
·48 lines (40 loc) · 813 Bytes
/
testphp.php
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
#!/usr/bin/php
<?php
echo "Test PHP BEGIN".PHP_EOL;
$arr = array();
$arr[] = 5;
$arr[] = 'potato';
$arr[] = 8.371;
$arr['tomato'] = "red";
$arr[] = "blue";
function thaFunc($word, array $arrr = NULL)
{
if ($arrr === NULL)
{
echo __FILE__.":".__LINE__.": NULL ARRAY".PHP_EOL;
return NULL;
}
$return = "";
foreach ($arrr as $ar)
{
echo __FILE__.":".__LINE__.": $word - $ar".PHP_EOL;
$return .= $ar;
}
return $return;
}
var_dump($arr);
echo __FILE__.":".__LINE__.":array size = ".count($arr).PHP_EOL;
foreach ($arr as $yarrr)
{
echo "array value:\" $yarrr".PHP_EOL;
}
echo "C style:\n";
for ($i = 0;$i < count($arr);$i++)
{
echo "array value: ".$arr[$i].PHP_EOL;
}
$ret = thaFunc("steve");
$ret = thaFunc("steve",$arr);
echo $ret.PHP_EOL;
echo "Test PHP END".PHP_EOL;
?>