Size: 1071
Comment:
|
Size: 2277
Comment:
|
Deletions are marked like this. | Additions are marked like this. |
Line 21: | Line 21: |
== intval == Get the integer value of a variable {{{#!highlight php <?php echo intval(42); // 42 echo intval(4.2); // 4 echo intval('42'); // 42 ?> }}} |
|
Line 37: | Line 48: |
== Class == {{{#!highlight php <?php class SimpleClass { // property declaration public $var = 'a default value'; // method declaration public function displayVar() { echo $this->var; } } class Foo { public static $my_static = 'foo'; public function staticValue() { return self::$my_static; } } class Bar extends Foo { public function fooStatic() { return parent::$my_static; } } class Foo { public static function aStaticMethod() { // ... } } class MyClass { const CONSTANT = 'constant value'; function showConstant() { echo self::CONSTANT . "\n"; } } class MyClass { public $public = 'Public'; protected $protected = 'Protected'; private $private = 'Private'; function printHello() { echo $this->public; echo $this->protected; echo $this->private; } } ?> }}} |
PHP
syslog
Generate a system log message
Log levels and files in operative systems
OS |
File |
Logged levels |
Slack64 14 |
/var/log/messages |
INFO |
Slack64 14 |
/var/log/syslog |
WARNING ERR CRIT |
CentOS 6.4 |
/var/log/messages |
INFO WARNING ERR CRIT |
Ubuntu 12.04 Precise |
/var/log/syslog |
DEBUG INFO WARNING ERR CRIT |
Debian 7.0 Wheezy |
/var/log/syslog |
DEBUG INFO WARNING ERR CRIT |
intval
Get the integer value of a variable
sprintf
Return a formatted string
str_replace
Replace all occurrences of the search string with the replacement string
Class
1 <?php
2 class SimpleClass
3 {
4 // property declaration
5 public $var = 'a default value';
6
7 // method declaration
8 public function displayVar() {
9 echo $this->var;
10 }
11 }
12
13 class Foo
14 {
15 public static $my_static = 'foo';
16
17 public function staticValue() {
18 return self::$my_static;
19 }
20 }
21 class Bar extends Foo
22 {
23 public function fooStatic() {
24 return parent::$my_static;
25 }
26 }
27
28 class Foo {
29 public static function aStaticMethod() {
30 // ...
31 }
32 }
33
34 class MyClass
35 {
36 const CONSTANT = 'constant value';
37
38 function showConstant() {
39 echo self::CONSTANT . "\n";
40 }
41 }
42
43 class MyClass
44 {
45 public $public = 'Public';
46 protected $protected = 'Protected';
47 private $private = 'Private';
48
49 function printHello()
50 {
51 echo $this->public;
52 echo $this->protected;
53 echo $this->private;
54 }
55 }
56
57 ?>