Jump to content

[SOLVED] implode multidimensional array column...


mkosmosports

Recommended Posts

My apologies. Yes, $mainarr['br']['sumconditions'] is an array and below is the $mainarr array

 

$mainarr = array("boundvalues"=>array(),
	  "br"=>array("sumconditions"=>array(),
                                  "resultconditions"=>array()),
	  "pd"=>array("sumconditions"=>array(),"resultconditions"=>array()));

running this code gives no output (as the array is empty) but there is no error message.

<?php
error_reporting(E_ALL);

$mainarr = array(
            "boundvalues" => array(),
            "br" => array(
                "sumconditions" => array(),
                "resultconditions" => array()
                ),
            "pd" => array(
                "sumconditions" => array(),
                "resultconditions" => array()
                )
            );

echo implode(" AND ", $mainarr['br']['sumconditions']);            
?>

Thanks Barand. I have figured out whats wrong, but I made the mistake of assuming multidimensional sub-arrays dont implode....  ??? Sorry.

 

Somewhere in my script I assigned a string to $mainarr['br']['sumconditions'] as opposed to assigning the string to $mainarr['br']['sumconditions'][], so I was in effect no longer imploding an array.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.