I have the following:
[6199]=>
array(12) {
["Origin"]=>
array(3) {
["name"]=>
array(1) {
[0]=>
string(4) "Cuba"
}
["slug"]=>
array(1) {
[0]=>
string(27) "cuabn-havana-habanos-cigars"
}
["id"]=>
array(1) {
[0]=>
int(0)
}
}
["Filler"]=>
array(3) {
["name"]=>
array(2) {
[0]=>
string(9) "Dominican"
[1]=>
string(10) "Nicaraguan"
}
["slug"]=>
array(2) {
[0]=>
string(9) "dominican"
[1]=>
string(10) "nicaraguan"
}
["id"]=>
array(2) {
[0]=>
int(0)
[1]=>
int(1)
}
}
}
[6192]=>
array(11) {
["Origin"]=>
array(3) {
["name"]=>
array(1) {
[0]=>
string(9) "Nicaragua"
}
["slug"]=>
array(1) {
[0]=>
string(27) "nicaraguan-new-world-cigars"
}
["id"]=>
array(1) {
[0]=>
int(0)
}
}
["Filler"]=>
array(3) {
["name"]=>
array(2) {
[0]=>
string(9) "Java"
[1]=>
string(10) "Nicaraguan"
}
["slug"]=>
array(2) {
[0]=>
string(9) "java"
[1]=>
string(10) "nicaraguan"
}
["id"]=>
array(2) {
[0]=>
int(0)
[1]=>
int(1)
}
}
}
and my expected output is:
array(12) {
["Origin"]=>
array(3) {
["name"]=>
array(1) {
[0]=>
string(4) "Cuba".
[1]=>
string(9) "Nicaragua"
}
["slug"]=>
array(1) {
[0]=>
string(27) "cuabn-havana-habanos-cigars",
[0]=>
string(27) "nicaraguan-new-world-cigars"
}
["id"]=>
array(1) {
[0]=>
int(0)
}
}
["Filler"]=>
array(3) {
["name"]=>
array(2) {
[0]=>
string(9) "Dominican"
[1]=>
string(10) "Nicaraguan"
[2]=>
string(9) "Java"
}
["slug"]=>
array(2) {
[0]=>
string(9) "dominican"
[1]=>
string(10) "nicaraguan"
[3]=>
string(9) "java"
}
["id"]=>
array(2) {
[0]=>
int(0)
[1]=>
int(1)
}
}
See how it eliminates dupes and merges each array maintaining the "origin" key.
I've tried :
foreach ($resultterms as $keyname => $valuename){
foreach ($valuename as $keysub => $valuesub) {
foreach($valuesub['name'] as $keysubsub => $valuesubsub){
# code...
$prods_atts[$keysub]['name'][$keysubsub] = $valuesubsub;
$prods_atts[$keysub]['slug'][$keysubsub] = $valuesub['slug'][$keysubsub];
$prods_atts[$keysub]['id'][$keysubsub] = $valuesub['id'][$keysubsub];
}
}
}
where $resultterms is the original arrays but it's not working. I was wondering if there was a wonderful php function I could use to merge these instead of so many nested for each loops?
I believe you're just looking for array_merge_recursive.
call_user_func_array('array_merge_recursive', array_values($prod_atts));
call_user_func_array allows to transform an array into a list of arguments
array_values because in the end, you seem to want to get rid of the first layer of your array
In order to try it, could you post the var_export of your variable instead of the var_dump?
echo(var_export($prod_atts, true));
merge your array by any suggested method. After that you will get duplicated values. And you need save only the unique items
$new = array_merge_recursive($resultterms['6199'], $resultterms['6192']);
foreach($new['Origin'] as &$item) { $item = array_unique($item); }
foreach($new['Filler'] as &$item) { $item = array_unique($item); }
Related
I'm grouping one multidimensional array by age.
This is my code:
$mEmployees = array (
array("name"=>"Pedro", "age"=>20, "ID"=>1111),
array("name"=>"Carlos", "age"=>15, "ID"=>2222),
array("name"=>"Susana", "age"=>20, "ID"=>3333),
array("name"=>"Carmen", "age"=>19, "ID"=>4444)
);
$byAge=array();
foreach ($mEmployees as $k => $oneItem) {
$byAge[$oneItem['age']][$k] = $oneItem;
}
var_dump($byAge);
That works fine as you can see below:
output:
array(3) {
[20]=>
array(2) {
[0]=>
array(3) {
["name"]=>
string(5) "Pedro"
["age"]=>
int(20)
["ID"]=>
int(1111)
}
[2]=>
array(3) {
["name"]=>
string(6) "Susana"
["age"]=>
int(20)
["ID"]=>
int(3333)
}
}
[15]=>
array(1) {
[1]=>
array(3) {
["name"]=>
string(6) "Carlos"
["age"]=>
int(15)
["ID"]=>
int(2222)
}
}
[19]=>
array(1) {
[3]=>
array(3) {
["name"]=>
string(6) "Carmen"
["age"]=>
int(19)
["ID"]=>
int(4444)
}
}
}
But in the results, the age key is redundant. I want to remove this key in the $byAge array.
I tried with array_slice, but it's not possible to indicate one irregular offset (the key age is in middle).
How I can achieve this easily for this result?
array(3) {
[20]=>
array(2) {
[0]=>
array(3) {
["name"]=>
string(5) "Pedro"
["ID"]=>
int(1111)
}
[2]=>
array(3) {
["name"]=>
string(6) "Susana"
["ID"]=>
int(3333)
}
}
[15]=>
array(1) {
[1]=>
array(3) {
["name"]=>
string(6) "Carlos"
["ID"]=>
int(2222)
}
}
[19]=>
array(1) {
[3]=>
array(3) {
["name"]=>
string(6) "Carmen"
["ID"]=>
int(4444)
}
}
}
Cache the age value in a variable and unset from $oneItem.
foreach ($mEmployees as $k => $oneItem) {
$age = $oneItem['age'];
unset($oneItem['age']);
$byAge[$age][$k] = $oneItem;
}
Demo: https://3v4l.org/pDDn5
I have this array, it could look something like this:
array(756) {
[0]=>
array(2) {
[0]=>
string(12) "joint_temps5"
[1]=>
string(4) "23.5"
}
[1]=>
array(2) {
[0]=>
string(12) "joint_temps4"
[1]=>
string(4) "23.5"
}
[2]=>
array(2) {
[0]=>
string(12) "joint_temps3"
[1]=>
string(2) "24"
}
[3]=>
array(2) {
[0]=>
string(12) "joint_temps2"
[1]=>
string(4) "24.5"
}
[4]=>
array(2) {
[0]=>
string(12) "joint_temps1"
[1]=>
string(2) "25"
}
[5]=>
array(2) {
[0]=>
string(12) "joint_temps0"
[1]=>
string(4) "25.5"
}
[6]=>
array(2) {
[0]=>
string(12) "joint_temps5"
[1]=>
string(4) "23.5"
}
[7]=>
array(2) {
[0]=>
string(12) "joint_temps4"
[1]=>
string(4) "23.5"
}
[8]=>
array(2) {
[0]=>
string(12) "joint_temps3"
[1]=>
string(2) "24"
}
[9]=>
array(2) {
[0]=>
string(12) "joint_temps2"
[1]=>
string(4) "24.5"
}
[10]=>
array(2) {
[0]=>
string(12) "joint_temps1"
[1]=>
string(2) "25"
}
[11]=>
array(2) {
[0]=>
string(12) "joint_temps0"
[1]=>
string(4) "25.5"
}
etc...};
How would i go about looping thru and splitting it up into arrays based on the value in the inner arrays[0] ex: "joint_temps5".
I have tested quite a few things but without success. My problem mainly is i dont know what might be in the string in the arrays.
I would like to end up with arrays like:
$array1[] = array(x_amount){
[0]=>
array(2) {
[0]=>
string(12) "joint_temps5"
[1]=>
string(4) "23.5"
}
[1]=>
array(2) {
[0]=>
string(12) "joint_temps5"
[1]=>
string(4) "23.5"
}
}
$array2[] = array(x_amount){
[0]=>
array(2) {
[0]=>
string(12) "joint_temps4"
[1]=>
string(4) "23.5"
}
[1]=>
array(2) {
[0]=>
string(12) "joint_temps4"
[1]=>
string(4) "23.5"
}
}
}
etc.
I would recommend to create a new array from your input array, using the value as an index of the array to be created, like so:
// test-set: input array is $a
$a[0] = array("joint_temps5","23.5");
$a[1] = array("joint_temps3","24");
$a[2] = array("joint_temps2","24.5");
$a[3] = array("joint_temps1","25");
$a[4] = array("joint_temps0","25.5");
$a[5] = array("joint_temps5","23.5");
$a[6] = array("joint_temps4","23.5");
$a[7] = array("joint_temps3","24");
$a[8] = array("joint_temps2","24.5");
$a[9] = array("joint_temps1","25");
foreach($a as $key => $value){
$b[$value[0]][] = $value; // *Explained below
}
*"Explained below": $a is the source array, $b is the newly created array.
$b[$value[0]][] means it wil create a new element for array $b[$value[0]]. And $value[0] will be substituted by the first value in the element of $a that the foreach loop hits.
Example: the first element of $a is this array: array("joint_temps5","23.5"). So in the foreach loop, the text "joint_temps5" ($value[0] in the foreach) will be used as a key/index to create a new element for array $b. The [] means that with every new execution of this line, a new element, with that key value $value[0], will be added.
It will result in:
array(6) {
["joint_temps5"]=>
array(2) {
[0]=>
array(2) {
[0]=>
string(12) "joint_temps5"
[1]=>
string(4) "23.5"
}
[1]=>
array(2) {
[0]=>
string(12) "joint_temps5"
[1]=>
string(4) "23.5"
}
}
["joint_temps3"]=>
array(2) {
[0]=>
array(2) {
[0]=>
string(12) "joint_temps3"
[1]=>
string(2) "24"
}
[1]=>
array(2) {
[0]=>
string(12) "joint_temps3"
[1]=>
string(2) "24"
}
}
["joint_temps2"]=>
array(2) {
[0]=>
array(2) {
[0]=>
string(12) "joint_temps2"
[1]=>
string(4) "24.5"
}
[1]=>
array(2) {
[0]=>
string(12) "joint_temps2"
[1]=>
string(4) "24.5"
}
}
["joint_temps1"]=>
array(2) {
[0]=>
array(2) {
[0]=>
string(12) "joint_temps1"
[1]=>
string(2) "25"
}
[1]=>
array(2) {
[0]=>
string(12) "joint_temps1"
[1]=>
string(2) "25"
}
}
["joint_temps0"]=>
array(1) {
[0]=>
array(2) {
[0]=>
string(12) "joint_temps0"
[1]=>
string(4) "25.5"
}
}
["joint_temps4"]=>
array(1) {
[0]=>
array(2) {
[0]=>
string(12) "joint_temps4"
[1]=>
string(4) "23.5"
}
}
}
You could loop through your array, and populate a new array using the string as a key, so something like:
foreach ($array as $working_array) {
$new_array[$working_array[0]][] = $working_array[1]; }
Which would give you an array something like :
$new_array["joint_temps5"]=> array(2) {
[0]=> "23.5"
[1]=> "23.5"}
If you needed to you could then parse that into an array in the format you desire quite easily.
I have a problem to transform my hierarchical array like this:
array(
[0]=>
array(3) {
["id"]=>
int(2353011010)
["name"]=>
string(17) "LEDER ACCESSOIRES"
["order"]=>
int(15)
}
[1]=>
array(3) {
["id"]=>
int(2371475010)
["name"]=>
string(15) "SPORT AUFKLEBER"
["order"]=>
int(25)
}
[2]=>
array(4) {
["id"]=>
int(2563635010)
["name"]=>
string(17) "KENNZEICHENHALTER"
["order"]=>
int(10)
["children"]=>
array(6) {
[0]=>
array(4) {
["id"]=>
int(3854259010)
["name"]=>
string(9) "EDELSTAHL"
["order"]=>
int(92)
["children"]=>
array(2) {
[0]=>
array(3) {
["id"]=>
int(20878056010)
["name"]=>
string(5) "test1"
["order"]=>
int(1)
}
}
}
[1]=>
array(3) {
["id"]=>
int(3854260010)
["name"]=>
string(5) "CHROM"
["order"]=>
int(91)
}
}
[3]=>
array(4) {
["id"]=>
int(19754330010)
["name"]=>
string(30) "SCHALTMANSCHETTEN CARBON OPTIK"
["order"]=>
int(3)
}
}
)
Into a flat ones like this:
array(
[0]=>
array(3) {
["id"]=>
int(2353011010)
["name"]=>
string(17) "LEDER ACCESSOIRES"
["order"]=>
int(15)
}
[1]=>
array(3) {
["id"]=>
int(2371475010)
["name"]=>
string(15) "SPORT AUFKLEBER"
["order"]=>
int(25)
}
[2]=>
array(3) {
["id"]=>
int(2563635010)
["name"]=>
string(17) "KENNZEICHENHALTER"
["order"]=>
int(10)
}
[3]=>
array(4) {
["id"]=>
int(3854259010)
["name"]=>
string(9) "EDELSTAHL"
["order"]=>
int(92),
["parentId"]=> 2563635010
}
[4]=>
array(4) {
["id"]=>
int(20878056010)
["name"]=>
string(5) "test1"
["order"]=>
int(1),
["parentId"]=> 2563635010
}
[5]=>
array(4) {
["id"]=>
int(3854260010)
["name"]=>
string(5) "CHROM"
["order"]=>
int(91),
["parentId"]=> 2563635010
}
[6]=>
array(4) {
["id"]=>
int(19754330010)
["name"]=>
string(30) "SCHALTMANSCHETTEN CARBON OPTIK"
["order"]=>
int(3)
}
)
The children antities should be removed and every child element should get a parentId entity of the higher level id. I need this solution for transfering into DB.
thx
Now, I have create a "temporary" method that works for me, but is noch flexible to use:
function recursive($categories) {
foreach ($categories as $value) {
$result[$value->id]['id'] = $value->id;
$result[$value->id]['name'] = $value->name;
$result[$value->id]['order'] = $value->order;
$result[$value->id]['parentId'] = 0;
if(isset($value->children)) {
$parentId = $value->id;
foreach($value->children as $value2) {
$result[$value2->id]['id'] = $value2->id;
$result[$value2->id]['name'] = $value2->name;
$result[$value2->id]['parentId'] = $parentId;
if(isset($value2->children)) {
$parentId = $value2->id;
foreach($value2->children as $value3) {
$result[$value3->id]['id'] = $value3->id;
$result[$value3->id]['name'] = $value3->name;
$result[$value3->id]['parentId'] = $parentId;
}
}
}
}
}
return $result;
}
Do anybody know a recursive solution for this method?
I have a text .. I went to extract triples from text .. I use Stanford-NLP Library in php Standford-NLP How can I extract triples(subject - object - predicate)?
The example code in the GitHub ReadMe shows how to write the code. The output is a list of word/part-of-speech pairs. Looking at the first example,
"What does the fox say?" becomes:
array(3) {
["wordsAndTags"]=>
array(6) {
[0]=>
array(2) {
[0]=>
string(4) "What"
[1]=>
string(2) "WP"
}
[1]=>
array(2) {
[0]=>
string(4) "does"
[1]=>
string(3) "VBZ"
}
[2]=>
array(2) {
[0]=>
string(3) "the"
[1]=>
string(2) "DT"
}
[3]=>
array(2) {
[0]=>
string(3) "fox"
[1]=>
string(2) "NN"
}
[4]=>
array(2) {
[0]=>
string(3) "say"
[1]=>
string(2) "VB"
}
[5]=>
array(2) {
[0]=>
string(1) "?"
[1]=>
string(1) "."
}
}
["penn"]=>
array(2) {
["parent"]=>
string(4) "ROOT"
["children"]=>
array(1) {
[0]=>
array(2) {
["parent"]=>
string(5) "SBARQ"
["children"]=>
array(3) {
[0]=>
array(2) {
["parent"]=>
string(4) "WHNP"
["children"]=>
array(1) {
[0]=>
array(2) {
["parent"]=>
string(7) "WP What"
["children"]=>
array(0) {
}
}
}
}
[1]=>
array(2) {
["parent"]=>
string(2) "SQ"
["children"]=>
array(3) {
[0]=>
array(2) {
["parent"]=>
string(8) "VBZ does"
["children"]=>
array(0) {
}
}
[1]=>
array(2) {
["parent"]=>
string(2) "NP"
["children"]=>
array(2) {
[0]=>
array(2) {
["parent"]=>
string(6) "DT the"
["children"]=>
array(0) {
}
}
[1]=>
array(2) {
["parent"]=>
string(6) "NN fox"
["children"]=>
array(0) {
}
}
}
}
[2]=>
array(2) {
["parent"]=>
string(2) "VP"
["children"]=>
array(1) {
[0]=>
array(2) {
["parent"]=>
string(6) "VB say"
["children"]=>
array(0) {
}
}
}
}
}
}
[2]=>
array(2) {
["parent"]=>
string(3) ". ?"
["children"]=>
array(0) {
}
}
}
}
}
}
["typedDependencies"]=>
array(5) {
[0]=>
array(3) {
["type"]=>
string(4) "dobj"
[0]=>
array(2) {
["feature"]=>
string(3) "say"
["index"]=>
int(5)
}
[1]=>
array(2) {
["feature"]=>
string(4) "What"
["index"]=>
int(1)
}
}
[1]=>
array(3) {
["type"]=>
string(3) "aux"
[0]=>
array(2) {
["feature"]=>
string(3) "say"
["index"]=>
int(5)
}
[1]=>
array(2) {
["feature"]=>
string(4) "does"
["index"]=>
int(2)
}
}
[2]=>
array(3) {
["type"]=>
string(3) "det"
[0]=>
array(2) {
["feature"]=>
string(3) "fox"
["index"]=>
int(4)
}
[1]=>
array(2) {
["feature"]=>
string(3) "the"
["index"]=>
int(3)
}
}
[3]=>
array(3) {
["type"]=>
string(5) "nsubj"
[0]=>
array(2) {
["feature"]=>
string(3) "say"
["index"]=>
int(5)
}
[1]=>
array(2) {
["feature"]=>
string(3) "fox"
["index"]=>
int(4)
}
}
[4]=>
array(3) {
["type"]=>
string(4) "root"
[0]=>
array(2) {
["feature"]=>
string(4) "ROOT"
["index"]=>
int(0)
}
[1]=>
array(2) {
["feature"]=>
string(3) "say"
["index"]=>
int(5)
}
}
}
}
Then I need to extract triples .. How can I do that?
I'm having trouble getting specific values from an array. I have tried this but it doesn't work.
$item1 = $this->request->post['banner_image'];
foreach($item1 as $k => $v)
{
if($k == 'top' && $v > 0)
{
echo $v.' - ';
}
}
I need to get only a few values... such us [top] and [left] for each one .
This is the var_dump($_POST);
array(2) {
["pavcontentslider_module"]=>
array(1) {
[0]=>
array(11) {
["layout_id"]=>
string(1) "1"
["position"]=>
string(9) "slideshow"
["status"]=>
string(1) "1"
["sort_order"]=>
string(1) "1"
["auto_play"]=>
string(1) "0"
["text_interval"]=>
string(4) "8000"
["width"]=>
string(4) "1170"
["height"]=>
string(3) "540"
["image_navigator"]=>
string(1) "1"
["navimg_weight"]=>
string(3) "184"
["navimg_height"]=>
string(2) "81"
}
}
["banner_image"]=>
array(6) {
[1]=>
array(7) {
["image"]=>
string(26) "data/slider/imgslider3.jpg"
["link"]=>
string(0) ""
["title"]=>
array(2) {
[4]=>
array(1) {
[0]=>
string(5) "testo"
}
[1]=>
array(1) {
[0]=>
string(8) "engtesto"
}
}
["effect"]=>
array(2) {
[4]=>
array(1) {
[0]=>
string(7) "tossing"
}
[1]=>
array(1) {
[0]=>
string(6) "bounce"
}
}
["class"]=>
array(2) {
[4]=>
array(1) {
[0]=>
string(12) "banner-info1"
}
[1]=>
array(1) {
[0]=>
string(11) "banner-info"
}
}
["top"]=>
array(2) {
[4]=>
array(1) {
[0]=>
string(2) "90"
}
[1]=>
array(1) {
[0]=>
string(3) "160"
}
}
["left"]=>
array(2) {
[4]=>
array(1) {
[0]=>
string(3) "660"
}
[1]=>
array(1) {
[0]=>
string(3) "335"
}
}
}
[2]=>
array(7) {
["image"]=>
string(26) "data/slider/imgslider7.jpg"
["link"]=>
string(0) ""
["title"]=>
array(2) {
[4]=>
array(1) {
[0]=>
string(5) "test2"
}
[1]=>
array(1) {
[0]=>
string(8) "engtest2"
}
}
["effect"]=>
array(2) {
[4]=>
array(1) {
[0]=>
string(7) "slideUp"
}
[1]=>
array(1) {
[0]=>
string(7) "slideUp"
}
}
["class"]=>
array(2) {
[4]=>
array(1) {
[0]=>
string(12) "banner-info1"
}
[1]=>
array(1) {
[0]=>
string(11) "banner-info"
}
}
["top"]=>
array(2) {
[4]=>
array(1) {
[0]=>
string(2) "91"
}
[1]=>
array(1) {
[0]=>
string(3) "183"
}
}
["left"]=>
array(2) {
[4]=>
array(1) {
[0]=>
string(3) "210"
}
[1]=>
array(1) {
[0]=>
string(3) "432"
}
}
}
[3]=>
array(7) {
["image"]=>
string(26) "data/slider/imgslider5.jpg"
["link"]=>
string(0) ""
["title"]=>
array(2) {
[4]=>
array(1) {
[0]=>
string(5) "testo"
}
[1]=>
array(1) {
[0]=>
string(7) "resrser"
}
}
["effect"]=>
array(2) {
[4]=>
array(1) {
[0]=>
string(7) "slideUp"
}
[1]=>
array(1) {
[0]=>
string(7) "slideUp"
}
}
["class"]=>
array(2) {
[4]=>
array(1) {
[0]=>
string(11) "banner-info"
}
[1]=>
array(1) {
[0]=>
string(11) "banner-info"
}
}
["top"]=>
array(2) {
[4]=>
array(1) {
[0]=>
string(2) "10"
}
[1]=>
array(1) {
[0]=>
string(2) "29"
}
}
["left"]=>
array(2) {
[4]=>
array(1) {
[0]=>
string(2) "20"
}
[1]=>
array(1) {
[0]=>
string(2) "66"
}
}
}
[4]=>
array(7) {
["image"]=>
string(26) "data/slider/imgslider6.jpg"
["link"]=>
string(0) ""
["title"]=>
array(2) {
[4]=>
array(1) {
[0]=>
string(5) "testo"
}
[1]=>
array(1) {
[0]=>
string(4) "teso"
}
}
["effect"]=>
array(2) {
[4]=>
array(1) {
[0]=>
string(7) "slideUp"
}
[1]=>
array(1) {
[0]=>
string(7) "slideUp"
}
}
["class"]=>
array(2) {
[4]=>
array(1) {
[0]=>
string(11) "banner-info"
}
[1]=>
array(1) {
[0]=>
string(11) "banner-info"
}
}
["top"]=>
array(2) {
[4]=>
array(1) {
[0]=>
string(2) "27"
}
[1]=>
array(1) {
[0]=>
string(2) "22"
}
}
["left"]=>
array(2) {
[4]=>
array(1) {
[0]=>
string(2) "61"
}
[1]=>
array(1) {
[0]=>
string(2) "66"
}
}
}
[5]=>
array(7) {
["image"]=>
string(26) "data/slider/imgslider8.jpg"
["link"]=>
string(0) ""
["title"]=>
array(2) {
[4]=>
array(1) {
[0]=>
string(5) "testo"
}
[1]=>
array(1) {
[0]=>
string(6) "tes6yo"
}
}
["effect"]=>
array(2) {
[4]=>
array(1) {
[0]=>
string(7) "slideUp"
}
[1]=>
array(1) {
[0]=>
string(7) "slideUp"
}
}
["class"]=>
array(2) {
[4]=>
array(1) {
[0]=>
string(11) "banner-info"
}
[1]=>
array(1) {
[0]=>
string(11) "banner-info"
}
}
["top"]=>
array(2) {
[4]=>
array(1) {
[0]=>
string(2) "20"
}
[1]=>
array(1) {
[0]=>
string(2) "14"
}
}
["left"]=>
array(2) {
[4]=>
array(1) {
[0]=>
string(2) "38"
}
[1]=>
array(1) {
[0]=>
string(2) "57"
}
}
}
[6]=>
array(7) {
["image"]=>
string(26) "data/slider/imgslider2.jpg"
["link"]=>
string(0) ""
["title"]=>
array(2) {
[4]=>
array(1) {
[0]=>
string(5) "testo"
}
[1]=>
array(1) {
[0]=>
string(5) "testo"
}
}
["effect"]=>
array(2) {
[4]=>
array(1) {
[0]=>
string(7) "slideUp"
}
[1]=>
array(1) {
[0]=>
string(7) "slideUp"
}
}
["class"]=>
array(2) {
[4]=>
array(1) {
[0]=>
string(11) "banner-info"
}
[1]=>
array(1) {
[0]=>
string(11) "banner-info"
}
}
["top"]=>
array(2) {
[4]=>
array(1) {
[0]=>
string(2) "29"
}
[1]=>
array(1) {
[0]=>
string(2) "25"
}
}
["left"]=>
array(2) {
[4]=>
array(1) {
[0]=>
string(2) "66"
}
[1]=>
array(1) {
[0]=>
string(2) "47"
}
}
}
}
}
A way to have a better look at your results are to first echo "<pre>"; before you var_dump. That will allow you to see how the array is formatted better. My guess is that the $key you're searching for is embedded at a deeper level. If you're still having trouble parsing it yourself try editing your post to allow us to see a better formatted view. It's hard to see but try echoing (without the for loop) $item1[1]['image'] and see if anything is spit out. I think the values you are interested are actually within $item1[1] rather than just $item1. Hopefully that made sense.