Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

look at 2: and 3: in the image. It should be 4, but return me '0'.

enter image description here

share|improve this question
    
What's the exact value of $UO2? Do a var_dump($UO2). –  Gergo Erdosi yesterday
    
@GergoErdosi: As you can see on the screenshot "4" (as string). –  Charlotte Dunois yesterday
3  
Yes, I can see. But I can also see that the text goes bold on the first line. So I suspect there is something else in the value which makes int casting to return 0. –  Gergo Erdosi yesterday
    
@GergoErdosi - very good catch! It can well be some HTML tags +1. Say you have something like $UO2 = " <div>3<b>"; then the casting will return 0 –  raidenace yesterday
2  
It would be much more useful if instead of providing a screenshot, you showed the underlying code as text. –  Tom Fenech yesterday

1 Answer 1

up vote 1 down vote accepted

I think that the problem is how you are using Simple HTML DOM.

You are exploding $element[2], which is the second <b> tag in the document. But it is not a string, it is an object representing the DOM element.

If you are trying to get the content of the tag you should use

$element[2]->innertext
share|improve this answer
    
WOW, thanks star Lord !!!! u got my positive :) –  Quim Serra 22 hours ago
1  
Pleased to see that my answer helped you. If my answer solved your problem click the big checkbox to accept it, so that everyone knows that the problem has been solved :) –  Claudio Venturini 21 hours ago

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.