Base64 только использует алфавитно-цифровые символы и '+' (плюс), '/' (наклонная черта) и '=' (равняется). Никакая потребность закодировать что-либо для XML.
PHP's meaning of overloading is different than Java's. In PHP, overloading means that you are able to add object members at runtime, by implementing some of the __magic
methods, like __get
, __set
, __call
, __callStatic
. You load objects with new members.
Overloading in PHP provides means to dynamically "create" properties and methods. These dynamic entities are обработанные магическими методами можно установить в классе для различных типы действий.
Пример:
class Foo
{
public function __call($method, $args)
{
echo "Called method $method";
}
}
$foo = new Foo;
$foo->bar(); // Called method bar
$foo->baz(); // Called method baz
И, кстати, PHP поддерживает этот вид перегрузки, начиная с PHP 4.3.0. Единственное отличие состоит в том, что в версиях до PHP 5 вам нужно было явно активировать перегрузку с помощью функции overload ()
.
If you want to overload a function like in Java, don’t specify any arguments and use the func_num_args
and func_get_args
function to get the number of arguments or the arguments themselves that were passed to that function:
function test() {
$args = func_get_args();
switch (count($args)) {
case 1:
// one argument passed
break;
case 2:
// two arguments passed
break;
default:
// illegal numer of arguments
break;
}
}