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
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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.