Web Developer

function: extract()

Syntax

extract ( array &$array [, int $flags = EXTR_OVERWRITE [, string $prefix = NULL ]] )

Description

extract — Import variables into the current symbol table from an array, Checks each key to see whether it has a valid variable name. It also checks for collisions with existing variables in the symbol table.

Code

<?php

/* Suppose that $var_array is an array returned from
   wddx_deserialize */

$size = "large";
$var_array = array("color" => "blue",
                   "size"  => "medium",
                   "shape" => "sphere");
extract($var_array, EXTR_PREFIX_SAME, "wddx");

echo "$color, $size, $shape, $wddx_size\n";

?>

output: blue, large, sphere, medium

Leave a Reply

Your email address will not be published. Required fields are marked *.

*
*
You may use these <abbr title="HyperText Markup Language">HTML</abbr> tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>