Код:
// extends 'from' object with members from 'to'. If 'to' is null, a deep clone of 'from' is returned
function extend(from, to)
{
if (from == null || typeof from != "object") return from;
if (from.constructor != Object && from.constructor != Array) return from;
if (from.constructor == Date || from.constructor == RegExp || from.constructor == Function ||
from.constructor == String || from.constructor == Number || from.constructor == Boolean)
return new from.constructor(from);
to = to || new from.constructor();
for (var name in from)
{
to[name] = typeof to[name] == "undefined" ? extend(from[name], null) : to[name];
}
return to;
}
Тест:
var obj =
{
date: new Date(),
func: function(q) { return 1 + q; },
num: 123,
text: "asdasd",
array: [1, "asd"],
regex: new RegExp(/aaa/i),
subobj:
{
num: 234,
text: "asdsaD"
}
}
var clone = extend(obj);
<?php
//$arr = your nested array aboe
foreach($arr as $v){
echo $v['value']; //this will print 'Webg Smarty CMS Small' first in your example followed by '713-332-4675'
}
$arr[0]['value'] will give you 'Webg Smarty CMS Small'
$arr[1]['value'] will give you '713-332-4675'
Попробуйте это
foreach($yourArr as $key => $value)
{
echo $value['value'];
}
ИЛИ
echo $yourArr[0]['value']; //print value of first element
echo $yourArr[0]['key']; //print key of first element