What s the deal with semicolons and colons for variables in PHP?

Updated on healthy 2024-04-14
9 answers
  1. Anonymous users2024-02-07

    1 Obviously, the two variables are not the same.

    2 I don't think I can see it.

    3 Variables can participate in calculations, temporarily store data, etc.

    Addendum: php declares variables that start with $, and it is best not to exceed this range: a-z or a-z or or 1-9 (numbers cannot be put in the first place, nor can they be pure numbers) This range is supported by most programming languages.

  2. Anonymous users2024-02-06

    This is wrong, and the correct one should be that this is the output of the segment markup.

    In PHP, variables are those that conform to the naming convention, and the rules are not very clear, as if they are.

    You can only start with letters and underscores.

    I'll give you an example of the featured variable that I said upstairs.

    a='b';

    b=1;echo $$a;

    The result of the output is 1

  3. Anonymous users2024-02-05

    class func

    function aaa()

    func::run();The run method of the static property in the func class is accessed.

    static stands for a static method or property, which only supports the call of the current class, and does not support inheritance.

    Test more and see if the error prompts.

  4. Anonymous users2024-02-04

    Calling Class Methods Static classes seem to be called just like that.

  5. Anonymous users2024-02-03

    The double colon operator, the scope resolution operator, can access properties and methods that are overridden in static, const, and classes. If you use it outside of the class definition, call it with the class name. In PHP, variables can be used instead of class names.

    Program List: Define external access to a class with variables.

    Program List: Used outside of the class definition:

    Program Running Result:

    fruit color red

  6. Anonymous users2024-02-02

    It's the same as ->, but the way to call a static variable with a class is the $ class: a static variable, and you can't write it as a $ class-> static variable, that's just a fixed way.

  7. Anonymous users2024-02-01

    ?: Works.

    Transcription with if ...else similar to attack,?It is known as the "Three Bai Yuan Yun Du Operator".

    **zhi$user = isset($_post['name']) post['name'] :' ' ;

    Equivalent to: DAO

    if(isset($_post['name'])else

  8. Anonymous users2024-01-31

    The for loop is the most complex loop structure in PHP. It behaves similarly to C. The syntax for the loop is:

    for (expr1; expr2; expr3)

    statement

    The first expression (expr1) is evaluated unconditionally once before the loop starts.

    expr2 evaluates before the start of each loop. If the value is true, the loop continues, executing the nested loop statement. If the value is false, the loop is terminated.

    expr3 is evaluated (executed) after each loop. Each expression can be empty. expr2 is null means that it will loop indefinitely (like c, PHP considers its value to be true).

    This may not be as useless as it seems, as it is often desirable to end the loop with a break statement rather than with the truth of the expression for.

    Consider the following example, which all show the numbers 1 through 10:

    break;

    echo $i;

    example 3 */

    i = 1;

    for (;

    if ($i > 10) {

    break;

    echo $i;

    i++;example 4 */

    for ($i = 1; $i <=10; echo $i, $i++)

    Of course, the first example seems the most normal (or the fourth), but you may find it convenient to use an empty expression in a for loop in many cases.

    PHP also supports alternative syntax for loops with colons.

    for (expr1; expr2; expr3):

    statement;

    endfor;

    This is all on the PHP manual.,It's recommended to take a look at the next one.

  9. Anonymous users2024-01-30

    Your question is too vague, please refine it.

    Isn't that so?

    user::login()

    This is how static methods and static properties are called.

Related questions
8 answers2024-04-14

The semicolon is the sign of the end of the statement, but the semicolon is not used after the loop, if, and subfunctions such as long long a (int b), and everything else is used, but two semicolons cannot be added, although it will not cause an error, but it may affect the result.

11 answers2024-04-14

Is it to jump somewhere on this page to add an anchor.

12 answers2024-04-14

Step 1: Enter iTunes by tapping on the icon. Step 2:

Notice the new Genius toolbar at the right end of the iTunes window. If it doesn't appear in the window, you can press the Genius toolbar toggle button once. Step 3: >>>More

15 answers2024-04-14

I don't quite understand what you mean.

30 answers2024-04-14

Oh, and the software of Office is developed in the UK, so we don't need to type in the shortcut keys to adjust the English to get our purpose. >>>More