Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 154 lines (135 sloc) 4.74 kb
58a52b16 » Andrey Hristov
2004-03-28 - Fixed the explanation and example about "classes must be declared b…
1 1. strrpos() and strripos() now use the entire string as a needle. Be aware
2 that the existing scripts may no longer work as you expect.
61e6cd2a » Moriyoshi Koizumi
2003-12-14 Reorganization.
3
1fa74586 » Andrey Hristov
2003-12-06 A small start for so called "not-yet-written faq" about small changes…
4 EX :
5 <?php
6 var_dump(strrpos("ABCDEF","DEF"));
7 var_dump(strrpos("ABCDEF","DAF"));
8 ?>
32f41d17 » Andrey Hristov
2003-12-13 add an example for illegal string offset. the example is stolen from …
9
61e6cd2a » Moriyoshi Koizumi
2003-12-14 Reorganization.
10 Will give you different results. The former returns 3 while the latter
11 returns false rather than the position of the last occurrence of 'D'.
12 The same applies to strripos().
13
14 2. Illegal use of string offsets causes E_ERROR instead of E_WARNING.
15
32f41d17 » Andrey Hristov
2003-12-13 add an example for illegal string offset. the example is stolen from …
16 EX :
61e6cd2a » Moriyoshi Koizumi
2003-12-14 Reorganization.
17 <?php
18 $a = "foo";
19 unset($a[0][1][2]);
20 ?>
21
22 Fatal error: Cannot use string offset as an array in ... on line 1
32f41d17 » Andrey Hristov
2003-12-13 add an example for illegal string offset. the example is stolen from …
23
61e6cd2a » Moriyoshi Koizumi
2003-12-14 Reorganization.
24 3. array_merge() was changed to accept only arrays. If a non-array variable is
25 passed, a E_WARNING will be thrown for every such parameter. Be careful
26 because your code may start emitting E_WARNING out of the blue.
32f41d17 » Andrey Hristov
2003-12-13 add an example for illegal string offset. the example is stolen from …
27
61e6cd2a » Moriyoshi Koizumi
2003-12-14 Reorganization.
28 4. Be careful when porting from ext/mysql to ext/mysqli. The following
29 functions return NULL when no more data is available in the result set
30 (ext/mysql's functions return FALSE).
31
32 - mysqli_fetch_row()
33 - mysqli_fetch_array()
34 - mysqli_fetch_assoc()
5ce35b82 » Moriyoshi Koizumi
2003-12-14 Note about Apache2 SAPI change.
35
36 5. PATH_TRANSLATED server variable is no longer set implicitly under
f4983c0d » foobar
2004-01-17 - Renamed all *php4* files to *php5*, changed all php4/PHP4 to php5/PHP5
37 Apache2 SAPI in contrast to the situation in PHP 4, where it is set to the
5ce35b82 » Moriyoshi Koizumi
2003-12-14 Note about Apache2 SAPI change.
38 same value as the SCRIPT_FILENAME server variable when it is not populated
39 by Apache. This change was made to comply with the CGI specification.
40 Please refer to bug #23610 for further information.
61e6cd2a » Moriyoshi Koizumi
2003-12-14 Reorganization.
41
7baf31fc » Andrey Hristov
2004-01-05 another example
42 6. Starting PHP 5.0.0 the T_ML_CONSTANT constant is no longer defined by the
43 ext/tokenizer extension. If error_reporting is set to E_ALL notices will
44 be produced. Instead of T_ML_CONSTANT for /* */ the T_COMMENT constant
45 is used, thus both // and /* */ are resolved as the T_COMMENT constant.
3bf293ff » andigutmans
2004-02-08 - Change from PHP5 -> PHP 5
46 However the PHPDoc style comments /** */ ,which starting PHP 5 are parsed
d5d2d9ef » Andrey Hristov
2004-01-17 Clarification about phpDoc comments. Spotted by Greag Beaver.
47 by PHP, are recongnized as T_DOC_COMMENT.
1a559924 » Andrey Hristov
2004-01-17 adding info about $argc and $argv in CLI mode
48
0fa195d2 » Andrey Hristov
2004-01-17 use Rasmus' words
49 7. $_SERVER should be populated with argc and argv if variables_order
50 includes "S". If you have specifically configured your system to not
51 create $_SERVER, then of course it shouldn't be there. The change was to
52 always make argc and argv available in the CLI version regardless of the
53 variables_order setting. As in, the CLI version will now always populate
54 the global $argc and $argv variables.
85de35e4 » Andrey Hristov
2004-01-24 Adding note about declaration first use after that for classes.
55
58a52b16 » Andrey Hristov
2004-03-28 - Fixed the explanation and example about "classes must be declared b…
56 8. In some cases classes must be declared before used. It only happens only
57 if some of the new features of PHP 5 are used. Otherwise the behaviour is
58 the old.
59 Example 1 (works with no errors):
85de35e4 » Andrey Hristov
2004-01-24 Adding note about declaration first use after that for classes.
60 <?php
58a52b16 » Andrey Hristov
2004-03-28 - Fixed the explanation and example about "classes must be declared b…
61 $a = new a();
62 class a {
63 }
64 ?>
65
66 Example 2 (throws an error):
67 <?php
68 $a = new a();
69 interface b{
70 }
71 class a implements b {
72 }
73 ?>
74
75 Output (example 2) :
76 Fatal error: Class 'a' not found in /tmp/cl.php on line 2
85de35e4 » Andrey Hristov
2004-01-24 Adding note about declaration first use after that for classes.
77
58a52b16 » Andrey Hristov
2004-03-28 - Fixed the explanation and example about "classes must be declared b…
78 9. get_class() starting PHP 5 returns the name of the class as it was
79 declared which may lead to problems in older scripts that rely on
b8b1b359 » Andrey Hristov
2004-08-24 new incompatibilities. maybe someone from the doc group will update the
80 the previous behaviour - the class name is lowercased. Expect the
81 same behaviour from get_parent_class() when applicable.
58a52b16 » Andrey Hristov
2004-03-28 - Fixed the explanation and example about "classes must be declared b…
82 Example :
83 <?php
84 class FooBar {
85de35e4 » Andrey Hristov
2004-01-24 Adding note about declaration first use after that for classes.
85 }
b8b1b359 » Andrey Hristov
2004-08-24 new incompatibilities. maybe someone from the doc group will update the
86 class ExtFooBar extends FooBar{}
58a52b16 » Andrey Hristov
2004-03-28 - Fixed the explanation and example about "classes must be declared b…
87 $a = new FooBar();
b8b1b359 » Andrey Hristov
2004-08-24 new incompatibilities. maybe someone from the doc group will update the
88 var_dump(get_class($a), get_parent_class($a));
85de35e4 » Andrey Hristov
2004-01-24 Adding note about declaration first use after that for classes.
89 ?>
58a52b16 » Andrey Hristov
2004-03-28 - Fixed the explanation and example about "classes must be declared b…
90
91 Output (PHP 4):
92 string(6) "foobar"
b8b1b359 » Andrey Hristov
2004-08-24 new incompatibilities. maybe someone from the doc group will update the
93 string(9) "extfoobar"
58a52b16 » Andrey Hristov
2004-03-28 - Fixed the explanation and example about "classes must be declared b…
94
95 Output (PHP 5):
96 string(6) "FooBar"
b8b1b359 » Andrey Hristov
2004-08-24 new incompatibilities. maybe someone from the doc group will update the
97 string(9) "ExtFooBar"
58a52b16 » Andrey Hristov
2004-03-28 - Fixed the explanation and example about "classes must be declared b…
98 ----------------------------------------------------------------------
99 Example code that will break :
100 //....
101 function someMethod($p) {
102 if (get_class($p) != 'helpingclass') {
103 return FALSE;
104 }
105 //...
106 }
107 //...
b8b1b359 » Andrey Hristov
2004-08-24 new incompatibilities. maybe someone from the doc group will update the
108 Possible solution is to search for get_class() and get_parent_class() in
109 all your scripts and use strtolower().
110
111 10. get_class_methods() returns the names of the methods of a class as they
112 declared. In PHP4 the names are all lowercased.
113 Example code :
114 <?php
115 class Foo{
116 function doFoo(){}
117 function hasFoo(){}
118 }
119 var_dump(get_class_methods("Foo"));
120 ?>
121 Output (PHP4):
122 array(2) {
123 [0]=>
124 string(5) "dofoo"
125 [1]=>
126 string(6) "hasfoo"
127 }
128 Output (PHP5):
129 array(2) {
130 [0]=>
131 string(5) "doFoo"
132 [1]=>
133 string(6) "hasFoo"
134 }
135
136 11. Assignment $this is impossible. Starting PHP 5.0.0 $this has special
137 meaning in class methods and is recognized by the PHP parser. The latter
138 will generate a parse error when assignment to $this is found
139 Example code :
140 <?php
141 class Foo {
142 function assignNew($obj) {
143 $this = $obj;
144 }
145 }
146 $a = new Foo();
147 $b = new Foo();
148 $a->assignNew($b);
149 echo "I was executed\n";
150 ?>
151 Output (PHP 4):
152 I was executed
153 Output (PHP 5):
154 PHP Fatal error: Cannot re-assign $this in /tmp/this_ex.php on line 4
58a52b16 » Andrey Hristov
2004-03-28 - Fixed the explanation and example about "classes must be declared b…
155
Something went wrong with that request. Please try again.