<?php
$firstArr = [
0 => [
'text' => 'Lorem',
'type' => 'string',
],
1 => [
'text' => 'Ipsum',
'type' => 'string',
],
2 => [
'text' => 32,
'type' => 'integer',
],
3 => [
'text' => 64,
'type' => 'integer',
],
4 => [
'text' => 128,
'type' => 'integer',
],
];
foreach ($firstArr as $values) {
$secondArr[] = $values['text'];
}
print_r($secondArr);
$secondArr[] = $values['text'];
let firstArr = [
{
text: 'Lorem',
type: 'string'
},
{
text: 'Ipsum',
type: 'string'
},
{
text: 32,
type: 'integer'
},
{
text: 64,
type: 'string'
},
{
text: 128,
type: 'string'
},
]
let secondArr = []
for(let item of firstArr){
secondArr.push(item.text)
}
console.log(secondArr)
let secondArr = firstArr.map(item => item.text)
console.log(secondArr)