1234

Php code posted by aaaaa
created at 22 Jan 05:12

Edit | Back
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Hello</title>
</head>

<body>
<?php
  echo "Trust me!<br>\n";
  echo "You can make it.<br>\n";
  $a = 5;
  $b = &$a;
  echo $a . "<br/>\n";
  echo $b . " !!<br/>\n";
  $b = 10;
  echo $a . '<br/>';
  echo $b . ' !!<br>';
  $a = 20;
  echo $a . '<br/>';
  echo $b . ' !!<br>';
  echo (float) $b . '<br>';
  $a = '12';      // $a 型別為 integer
  $a[0] = 'Hi!';
  echo '<HR>';
  echo $a . '<BR>';
  $bb = 'Go';
  $bb = (array) $bb;
  echo $bb[0] . '<BR>';
  $bb[0] = 'N';
  echo $bb[0] . '<br>';
  echo '<HR>';
  $c = '01';
  echo '<p>' . $c . ' => ' . $c . '</p>';
  $c++;
  echo '<p>' . $c++ . ' => ' . $c . '</p>';
  $c = $c + 1;
  echo '<p>' . ($c + 1) . ' => ' . $c . '</p>';
  
  class person {
    function who(){
      echo 'I\'m Andy';
    }
    function say(){
      echo 'say what?';
    }
  }
  $man = new person;
  $man->who();
  echo '&nbsp;';
  $man->say();
  echo '<hr>';
  
  function suma(){
    $a = 1;
    $b = 2;
    echo ($a + $b) . '<BR>';
  }
  suma();
  echo $a . '<BR>';
  echo "\n";
  $d = 10;
  function sumaa(){
    global $d;
    echo $d . '<br>';
    $d++;
    echo $d . '<br>';
  }
  sumaa();
  $d++;
  echo $d . '<BR>';
  
  function mysum() {
    static $aaa = 1;
    if ($aaa < 20) {
      echo $aaa;
      $aaa++;
      mysum();
    }
  }
  mysum();
  echo '<HR>';
  $f = '123';
  $ff = (integer) $f;
  echo 'gettype "$ff" is : ' . gettype($ff) . ' and value is : ';
  echo $ff;
  echo '<HR>';
  echo $_SERVER['HTTP_USER_AGENT'] . '<BR>';
  echo $_SERVER['HTTP_HOST'] . '<BR>';
  echo "<BR>\n";
  echo "<pre>\n";
  print_r($_SERVER);
  echo "</pre>\n";
?>
</body>
</html>
1.8 KB in 6 ms with coderay