extract() method example in PHP


Techno Trendz

by using extract() function, we can create variables with associative arrays elements

varaible names are element keys and variable values are element values

<?php
$arr=array('x'=>10,'y'=>20,30,'abc'=>'scott');
extract($arr);
echo $x;  //10
echo $y;  //20
echo $abc;  //scott
?>

View original post