Jump to content

Array help


twittoris

Recommended Posts

I am trying to assign the output getElementsBtTagName to an array.

I am new to arrays and so far i have this:

 

    foreach ($rows as $row) 
    { 
	/*** get each column by tag name ***/ 
	$cols = $row->getElementsByTagName('td');
	//Declare array
	$address = array();
	if($row->childNodes->length) {
		foreach($row->childNodes as $ii) {
		$address[$ii->nodeName] = $ii ->nodeValue;
		}
	}
	$adresses[] = $address;    
    /*** echo the values ***/ 
    echo $cols->item(0)->nodeValue.'<br />';
	echo '<hr />'; 
	echo $address;

 

 

 

 

 

 

 

 

 

 

 

 

;

Link to comment
https://forums.phpfreaks.com/topic/213527-array-help/
Share on other sites

Still a little hazy as to what you're exactly trying to achieve, I see you have another thread though...

 

Is your code failing? Errors? Not creating correct output? What is your output?

 

Perhaps this line is giving you an error due to the space?

$address[$ii->nodeName] = $ii ->nodeValue;

Link to comment
https://forums.phpfreaks.com/topic/213527-array-help/#findComment-1111509
Share on other sites

yeah I have worked through all the other issues. This is my last one. I dont even know if its possible to put the output of a dom xpath into an array. I was hoping a veteran php-er would see what im trying to do and explain how to fix it if at all possible.

 

Hire someone then.

Link to comment
https://forums.phpfreaks.com/topic/213527-array-help/#findComment-1112385
Share on other sites

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.