Hi all,
I have a code which will ocr an image, and return the text from the image. The text is returned properly, however I am not able to extract it from the data-structure. When I tried to var_dump the variable, here is what I got :
stdClass Object
( [OCRWSResponse] => stdClass Object
( [ocrText] => stdClass Object
( [ArrayOfString] => stdClass Object
( [string] => THIRUKKURAL 61. On Truthfulness Is it asked 'What is truth?' It is the speaking of such words as are without the least degree of evil (to others). 1 Even falsehood has the nature of truth, if it confer a benefit that is free from fault. 2 Let not a man knowingly tell a lie; for after he has told the lie, his mind will burn him (with the memory of his guilt). 3 He, who in his conduct preserves a mind free from deceit, will dwell in the minds of all men. 4 He, who speaks truth with his heart, is superior to those who make gifts and practise austerities. 5 There is no praise like the praise of never utterin _. . I. without giving any suffering; it will leaI CH. 30
)
)
[ocrWSWords] => stdClass Object ( )
)
)
I want to extract the string "THIRUKKURAL 61. On Truthfulness Is it asked 'What is truth?' It is the speaking of such words as are without the least degree of evil (to others). 1 Even falsehood has the nature of truth, if it confer a benefit that is free from fault. 2 Let not a man knowingly tell a lie; for after he has told the lie, his mind will burn him (with the memory of his guilt). 3 He, who in his conduct preserves a mind free from deceit, will dwell in the minds of all men. 4 He, who speaks truth with his heart, is superior to those who make gifts and practise austerities. 5 There is no praise like the praise of never utterin _. . I. without giving any suffering; it will leaI CH. 30 " from the data-structure and display it.
Please help me out!!
Thanks in advance!!
Cheers,
--
Ajith
Extracting Data from an array of objects
Moderator: General Moderators
-
ajith_rock
- Forum Newbie
- Posts: 11
- Joined: Wed Sep 08, 2010 2:37 am
Re: Extracting Data from an array of objects
Try
Code: Select all
echo $variable->OCRWSResponse->ocrText->ArrayOfString->string;-
ajith_rock
- Forum Newbie
- Posts: 11
- Joined: Wed Sep 08, 2010 2:37 am
Re: Extracting Data from an array of objects
That was awesome!! It worked!!
Thanks a bunch!!
Cheers,
--
Ajith
Thanks a bunch!!
Cheers,
--
Ajith