extract

int extract(array array, [int collision_flag], [string prefix]) 
array Array containing data to extract
collision_flag What to do on a name collision (see description)
prefix Prefix to give to extracted variables

Imports variables into the local symbol table from an array.

Returns:

Void in versions of PHP prior to 4.0.5; in 4.0.5 and later versions, returns the number of elements extracted

Description:

This function iterates through the array given by array and, for each element, creates a variable in the local scope that’s named by the key of the element and whose value is the value of the element.

There are a couple of issues of which you should be aware. First, if a variable in the local scope has the same name as one of the ...

Get PHP Functions Essential Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.