Is there any best practice for this question? Or how is your code selected? I personally think the sprintf class Cprintf syntax is more concise. Is there any best practice? Or how is your code selected?
I personally thinksprintf
Class Cprintf
Simpler syntax
Reply content:
Is there any best practice for this question? Or how is your code selected?
I personally thinksprintf
Class Cprintf
Simpler syntax
- In terms of concept, "." is an operator, which is similar to addition and subtraction operations. "sprintf" is a function.
- Taking the lotusphp framework I have developed for six years as an example, the point operator is used in more than 150 files, and sprintf is only used in 5 files.
In use cases, sprintf has the following advantages (functional ):
- Output special format. For example, an unsigned integer, see Case: https://code.google.com/p/lotusphp/so... (109th rows); and, for example, fill in space or 0 before or after the output string, see the official documentation: http://cn2.php.net/sprintf (example 7)
- When multiple variables are merged into a new string, the position of the variable in the new string is defined by the input parameter (instead of the code you are writing that is defined by multiple vertex operators ). Example: https://code.google.com/p/lotusphp/so... (line 83)
- After defining a new string template, You need to synthesize strings Based on the template multiple times. If the dot operator is used, redundant code is generated. Reference case (this case has a string template, but not multiple calls, you can imagine): https://code.google.com/p/lotusphp/so...
Sprintf is inferior to vertices, for example, echo 'Hello '. $ _ GET ["username"]; include $ ROOT_PATH. '/lib/db. class. php '; I don't think anyone can simplify the process to use sprintf.
Special Account Application answer
You cannot use the url that is spliced by clicking here in curl. It is easy for new users to get stuck !!!