Php array processing function extract and instance code

Source: Internet
Author: User
The phpextract function uses the array key name as the variable name and the array key value as the variable value. This function can process form submission and insert data into the database. This article will explain the basic usage and examples of the extract function. For more information, see The php array processing function extract.

The extract function is used to import variables from an array to the current symbol table.

Basic syntax

Int extract (array & $ var_array [, int $ extract_type = EXTR_OVERWRITE [, string $ prefix = NULL])

This function is used to import variables from the array to the current symbol table. Check each key name to see if it can be used as a valid variable name, and check for conflicts with existing variable names in the symbol table.

Parameter introduction:

Return value

Returns the number of variables successfully imported to the symbol table.

Instance:

 "Blue", "size" => "medium", "shape" => "sphere"); extract ($ var_array, EXTR_PREFIX_SAME, "wddx"); echo "$ color, $ size, $ shape, $ wddx_size
";?>

Running result:

Blue, large, sphere, medium

Thank you for reading this article. I hope it will help you. thank you for your support for this site!

For more details about the php array processing function extract and related articles on instance code, please follow the PHP Chinese network!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.