Initialization of variables How do you write?
Low number of variable initialization
If it's a lot of time, it's a little uncomfortable.
$a, $b, $c, $d, $e .....
Written like this
$a = 0;
$b = 0;
$c = 0;
$d = 0;
$e = 0;
....
Not good, inconvenient, uncomfortable ...
So how do you initialize it? Don't tell me not to initialize, turn off the error prompt.
------Solution--------------------
$a = $b = $c =...=0;
$d = $e =...=array ();
Is this a good thing to watch? Haha, I didn't get too many variables to initialize.
------Solution--------------------
If there is no law, then we can only human flesh. There are rules to write. If the extract/list can be used from the array;
Quote a paragraph:
PHP Code
$my _array = Array ("A" = "Cat", "b" = "Dog", "c" = "Horse"), extract ($my _array); echo "\ $a = $a; \ $b = $b; \ $c = $c "; Output: $a = Cat; $b = Dog; $c = Horse
------Solution--------------------
I won't design so many variables haha. Just write a few lines.
------Solution--------------------
PHP allows non-initialization of variables, which shows the flexibility and simplicity of PHP
If you must initialize it,
Extract (Array_flip (Explode (', ', ' a,b,c,d,e,f,g,h '));
$a = 0;
$b = 0;
$c = 0;
$d = 0;
$e = 0;
.... Bother!!
$a = $b = $c =...=0;
$d = $e =...=array (); also annoying!!
------Solution--------------------
One day, when PHP becomes a compiled language, it's not annoying. What's bothering you?
------Solution--------------------
Not only to write interlaced, but also to fill each line with comments.
What does the report say about initializing so many variables? Share your design.
I've also done a custom report function, select the selection of the selected fields to add statistics to add a filter search, it seems like there is no need to initialize multiple variables.
------Solution--------------------
Originally people PHP design time, is can be variable when use when define, do not know. The elder brother, modified PHP into a similar strong type of nondescript things. Like a bastard. It's not easy, PHP programmers are hard-pressed.