Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Converting array to single variables [duplicate]

Tags:

php

Possible Duplicate:
Array to named variables

How can I convert an array like this

$data = array(
    'name' => 'something',
    'another' => 'variable'
);

to

$name = 'something';
$another = 'variable';

Is there a way how I can do this without looping?


1 Answers

That what you want to do is basically bad idea. If you are extracting array with data that comes from user, it's easy to hack your site. But if you really want to do this, use extract function.

like image 117
Robik Avatar answered Mar 28 '26 02:03

Robik



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!