Hi everyone! I'm the author of code.mu :)
I'd love to chat with my non-Russian audience. I'm looking for your feedback on the site and the translation quality. Let's chat:)
157 of 410 menu
◀ ▶

The extract Function

The extract function imports elements of an associative array into variables. The names of the variables will be the keys of the associative array.

Syntax

extract(array &$array, int $flags = EXTR_OVERWRITE, string $prefix = ""): int

Example

Let's extract variables from the array:

<?php $arr = ['a' => 1, 'b' => 2, 'c' => 3]; extract($arr); echo($a); echo($b); echo($c); ?>

Code execution result:

1 2 3

See Also

  • the list function,
    which destructures an array into variables
  • the array_keys function,
    which returns the keys of an array
  • the in_array function,
    which checks if a value exists in an array
← →
↑
English▼
AfrikaansAzərbaycanБългарскиবাংলাБеларускаяČeštinaDanskDeutschΕλληνικάEspañolEestiSuomiFrançaisहिन्दीMagyarՀայերենIndonesiaItaliano日本語ქართულიҚазақ한국어КыргызчаLietuviųLatviešuМакедонскиMelayuမြန်မာNederlandsNorskPolskiPortuguêsRomânăРусскийසිංහලSlovenčinaSlovenščinaShqipСрпскиSrpskiSvenskaKiswahiliТоҷикӣไทยTürkmenTürkçeЎзбекOʻzbekTiếng Việt
We use cookies for website operation, analytics, and personalization. Data processing is carried out in accordance with the Privacy Policy.
accept all customize decline