You can use the array_combine
function, like so:
$numbers = array('first', 'second', 'third');
$result = array_combine($numbers, $numbers);
More Related Contents:
- How to make array inside in foreach loop – php? [closed]
- How can I sort arrays and data in PHP?
- How to Flatten a Multidimensional Array?
- Sort array of objects by object fields
- Get the first element of an array
- + operator for array in PHP?
- How to reindex an array?
- How to sort an array of UTF-8 strings?
- Casting an Array with Numeric Keys as an Object
- How to trim white spaces of array values in php
- Get all mysql selected rows into an array
- What is better in a foreach loop… using the & symbol or reassigning based on key?
- Select from mysql table WHERE field=’$array’?
- How to set an Arrays internal pointer to a specific position? PHP/XML
- Algorithm to get all possible string combinations from array up to certain length
- How to cast array elements to strings in PHP?
- Make multiple files to force-download
- Sort multidimensional array by date column, then use other column values if dates are the same
- Array_map function in php with parameter
- Get date range between two dates excluding weekends
- How to merge two arrays by summing the merged values [duplicate]
- PHP merge arrays by value
- How to search in an array with preg_match?
- PHP array replace after matching value [duplicate]
- MySQL query using an array [duplicate]
- PHP get previous array element knowing current array key
- Moving array element to top in PHP
- phpexcel Allowed memory size of 134217728 bytes exhausted [duplicate]
- Check if all values in array are the same
- PHP, pass array through POST