Sometimes your data comes in two separate pieces. Maybe you read from a CSV file: $headers = ['name', 'email', 'role']; $row = ['Alice', 'alice@example.com', 'admin']; To turn this into an associative array: $user = array_combine($headers, $row); /* [ 'name' => 'Alice', 'email' => 'alice@example.com', 'role' => 'admin' ] */
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter