Array value to new instance

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • N8F0x
    New Member
    • May 2018
    • 1

    Array value to new instance

    I want to make every entry of an array to a new instance variable with the same name as the names and values in the array.

    Code:
      
    	$variables = array(
    		    array(
    			"name" => $row[name],
    			"value" => $row[value]
    		    )
    		    
    		);
    		// Printing all the keys and values one by one
    		$keys = array_keys($variables);
    		for($i = 0; $i < count($variables); $i++) {
    		    
    		       foreach($variables[$keys[$i]] as $key => $value) {
    
    			   /* every key saved as new variable with the same 
                                  name as saved in the array and declared with 
                                  the same value as in the array, so that I
                                  can access the instance like $uniqeVariableInArray = valueOfThisVariable. 
                               
                                var $row[name] = $row[value];                 
    */		   
    		       }
    		     
    		    echo "<br>";
    		}
Working...