Welcome to collectivesolver - Programming & Software Q&A. A website you can trust. All programs tested and works. Contact: aviboots(AT)netvision.net.il
GreenGeeks Web Hosting - Faster, Scalable & Eco-Friendly

BlueHost Web Hosting

Ecommerce Software - Best Ecommerce Platform Made for You - Free Trial

Ecommerce Software - Best Ecommerce Platform Made for You - Free Trial

getflywheel wordpress hosting


Distribute your Resume to 500+ Job Boards & Recruiters


8,101 questions

11,281 answers

573 users

How to create array from other array in PHP

2 Answers

0 votes
$arr[0]['key'] = 'site_title';
$arr[0]['english'] = "All On Page";
$arr[0]['gibberish'] = "a@sd a7de kd@#";

$arr[1]['key'] = 'site_url';
$arr[1]['english'] = "allonpage.com";
$arr[1]['gibberish'] = "a23ds6@3d!.com";
    
foreach ($arr as $i=>$val)
    $language[$arr[$i]['key']] = $arr[$i]['english'];
    
echo "<pre>";
print_r($language);
echo "</pre>";

foreach ($arr as $i=>$val)
    $language[$arr[$i]['key']] = $arr[$i]['gibberish'];
    
echo "<pre>";
print_r($language);
echo "</pre>";

  
/*
run: 
 
Array
(
    [site_title] => All On Page
    [site_url] => allonpage.com
)
Array
(
    [site_title] => a@sd a7de kd@#
    [site_url] => a23ds6@3d!.com
)
   
*/ 

 




answered Jun 7 by avibootz
0 votes
$arr[0]['key'] = 'site_title';
$arr[0]['english'] = "All On Page";
$arr[0]['gibberish'] = "a@sd a7de kd@#";

$arr[1]['key'] = 'site_url';
$arr[1]['english'] = "allonpage.com";
$arr[1]['gibberish'] = "a23ds6@3d!.com";
    
foreach ($arr as $i=>$val)
    $language[$arr[$i]['key']] = $arr[$i]['english'];
    
echo $language['site_title'] . "<br />";
echo $language['site_url'] . "<br />";

foreach ($arr as $i=>$val)
    $language[$arr[$i]['key']] = $arr[$i]['gibberish'];
    
echo $language['site_title'] . "<br />";
echo $language['site_url'] . "<br />";

  
/*
run: 
 
All On Page
allonpage.com
a@sd a7de kd@#
a23ds6@3d!.com
   
*/

 




answered Jun 7 by avibootz
...