PHP extract() FunctionThe extract( ) function is an inbuilt function of PHP, and it is used to import variables into the local symbol table from an array. This function was introduced in 4.0. SyntaxParametersarray: This parameter is required. This specifies the array to use. flags: This parameter is optional. The extract() function checks for invalid variable names and collisions with existing variable names. This parameter specifies how invalid and colliding names will be treated. prefix: This parameter is optional. This parameter specifies the prefix. The prefix is automatically separated from the array key by an underscore character. Also this parameter is required only when the parameter $extract_rule is set to EXTR_PREFIX_SAME, EXTR_PREFIX_ALL, EXTR_PREFIX_INVALID or EXTR_PREFIX_IF_EXISTS. ReturnsThe extract( ) function returns the number of variables extracted on success. Example 1Output: ajeetnoida Example 2Output: batmanjoker Example 3Output: tendulkarvirat Example 4Output: ASSAMKERELA Next TopicPhp-array-fill-function |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India