Warning: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead in F:\OpenServer\domains\php-fusion.vveb.ws\includes\bbcodes\mail_bbcode_include.php on line 20
Warning: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead in F:\OpenServer\domains\php-fusion.vveb.ws\includes\bbcodes\mail_bbcode_include.php on line 21
Warning: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead in F:\OpenServer\domains\php-fusion.vveb.ws\includes\bbcodes\search_bbcode_include.php on line 39
Function and Method Declaration PHP-Fusion Coding Style PHP-Fusion version 7.02.00
Functions must be named according to PHP-Fusion's funcEon naming convenEons. Methods inside
classes must always declare their visibility by using one of the private, protected, or public
modi.ers. As with classes, the brace should always be wriLen on the same line as the funcEon
name. Space between the funcEon name and the opening parenthesis for the arguments is not
permiLed.
FuncEons in the global scope are strongly discouraged.
The following is an example of an acceptable funcEon declaraEon in a class:
PHP
<?php
classMyClass{
// Method description here
publicfunctionmyFunction(){
// all contents of function
// must be indented by one tab
}
}
?>
In cases where the argument list exceeds the maximum line length, you may introduce line breaks.
AddiEonal arguments to the funcEon or method must be indented one addiEonal level beyond the
funcEon or method name. A line break should then occur before the closing argument parent,
which should then be placed on the same line as the opening brace of the funcEon or method with
one space separaEng the two, and at the same indentaEon level as the funcEon or method
declaraEon. The following is an example of one such situaEon:
PHP
<?php
classMyClass{
// Method description here
publicfunctionmyFunction($arg1,$arg2,$arg3,
$arg4,$arg5,$arg6){
// all contents of function
// must be indented one tab
}
}
?>
The return value must not be enclosed in parentheses. This can hinder readability, in addiEonal to
breaking code if a method is later changed to return by reference.
PHP
<?php
classMyClass{
// WRONG
publicfunctionmyFunction(){
return($this->value);
}
// RIGHT
publicfunctionmyFunction(){
return$this->value;
}
}
?>
Изменил(а) Admin , 04.06.2013 20:54:02
Опубликовано 04.06.2013 20:52:59
Перейти на форум:
HTML-code and BB-code for blogs and forums
<a href="https://php-fusion.vveb.ws/forum/viewthread.php?thread_id=151">Function and Method Declaration : Function and Method Declaration</a>
[url=https://php-fusion.vveb.ws/forum/viewthread.php?thread_id=151]Function and Method Declaration : Function and Method Declaration[/url]