Click here to Skip to main content
15,890,438 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
I found following code what is purpose of using braces around key,like this ${$key}
PHP
$expected = array( 'carModel', 'year', 'bodyStyle' );

foreach( $expected AS $key ) 
{
 if ( !empty( $_POST[ $key ] ) ) {
  ${$key} = $_POST[ $key ];
 }
 else 
 {
  ${$key} = NULL;
 }
}
Posted
Updated 4-Jul-13 20:41pm
v2

1 solution

This code is similar with
PHP
$carModel = $_POST['carModel'];
$year = $_POST['year'];
$bodyStyle = $_POST['bodyStyle'];
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900