PHP lesson (2) PHP variable scope, string function

Variable scope

Four different variable scopes ( local local; global global; static static; parameter parameter )

Local and global variables:

 

Global keywords: use keywords inside variables called outside the function; (not recommended)

PHP stores all global variables in an array called $ GLOBALS [index] .

 

Static scope: When a function is completed, all its variables are usually deleted. However, sometimes you want certain local variables not to be deleted.

 

parameter scope parameter: the parameter value is passed to the local variable by calling code;

 

String function

  1. The concatenation operator: Use " . " To connect two string values .
  2. strlen ()  function returns the length of the string (number of characters)
  3. The strpos ()  function is used to find a character or a specified text within a string .

If a match is found in the string, the function returns the first matched character position. If no match is found, FALSE is returned .

 

Guess you like

Origin www.cnblogs.com/ltl11230/p/12751230.html