Did you know that PHP can extract values from arrays as variables? extract()
If you already knew this you are an incredible developer, for me it is a new world. This programming language has very good functions that I don't know about, but it's easy to understand what they do.
Thanks to a video on youtube I found that you can do crazy things like create a variable from data inside an array with php.
I was very surprised because one uses the variables to store data, but this is another world; It provides a greater advantage since it does not require filtering and verifying the data as it would have to be done with "javascript".
0
0
0.000
The early versions of PHP automatically extracted $_POST, $_GET and $_COOKIE arrays as variables.
This made programming with PHP super easy as one could define variables in a form and use them in a script.
They deprecated this feature because PHP programmers were lazy about initializing variables. Specifically, there was a code base that did something like:
If a hacker called the code with ?has_access=1 in the URL, then they could get the keys to the kingdom.
!WINE
Congratulations, @irivers You Successfully Shared 0.100 WINEX With @dobro2020.
You Earned 0.100 WINEX As Curation Reward.
You Utilized 1/1 Successful Calls.
Contact Us : WINEX Token Discord Channel
WINEX Current Market Price : 0.081
Swap Your Hive <=> Swap.Hive With Industry Lowest Fee (0.1%) : Click This Link
Read Latest Updates Or Contact Us
so will you recomend me use other method and not "extrac()" to get data from array as variables?
I think PHP extract is a wonderful tool.
Personally I stopped using it. I like to explicitly initialize all the variables in a program.
I also don't like making copies of data. Anymore, I just draw data directly from the array.
Whenever I do use extract, I use it at the beginning of the program to assure that extract does not override any variables that I declared.