[PHP] Re: Object Array?

2006-05-18 Thread Daniel Orner
	Try using var_dump rather than print_r... maybe it'll give you more 
accurate data (e.g. to figure out if it's an object, as Rob said, or an 
array).


--Daniel

Jay Paulson wrote:

I tried with no success yesterday to get an answer to this question so I'll
try again.

I have an object from using simpleXML and inside that object is an array
holding even more objects.  However, it's not acting like an array and
therefore I can't go through it. (i.e. I can't use the count function to see
how big it is and loop through it)

This below should be an array:

$xml-RES-R

When I use print_r($xml-RES-R) I get $xml-RES-R[0] printed, which is
below:

SimpleXMLElement Object
(
[U] = http://.../benefits/
[UD] = http://.../benefits/
[UE] = http://.../benefits/
[T] = bBenefits/b

[RK] = 10
[CRAWLDATE] =  17 May 2006
[FS] = SimpleXMLElement Object
(
)

[S] = Home, bBenefits/b Forms Jobs Training Locations, Who We Are
E-Info Publications EVAbr Team Websites. b.../b 2006 bBenefits/b
Vote. bBenefits/b Links. bBenefits/b Websites. b.../b
[LANG] = en
[HAS] = SimpleXMLElement Object
(
[L] = SimpleXMLElement Object
(
)

[C] = SimpleXMLElement Object
(
)

)

)


When I use print_r($xml-RES) I get the below.  As you can see [R] = Array
but yet in the above example it is an object.  I'm so confused and lost.
Can anyone help?  PHP version 5.0.4

SimpleXMLElement Object
(
[M] = 2010
[FI] = SimpleXMLElement Object
(
)

[NB] = SimpleXMLElement Object
(
[NU] =
/search?q=benefitssite=default_collectionhl=enlr=ie=UTF-8output=xml_no_
dtdclient=default_frontendaccess=psort=date:D:L:d1start=10sa=N
)

[R] = Array
(
[0] = SimpleXMLElement Object
(
[U] = http://.../benefits/
[UD] = http://.../benefits/
[UE] = http://.../benefits/
[T] = bBenefits/b

[RK] = 10
[CRAWLDATE] =  17 May 2006
[FS] = SimpleXMLElement Object
(
)

[S] = Home, bBenefits/b Forms Jobs Training
Locations, Who We Are E-Info Publications EVAbr Team Websites. b.../b
2006 bBenefits/b Vote. bBenefits/b Links. bBenefits/b Websites.
b.../b  
[LANG] = en

[HAS] = SimpleXMLElement Object
(
[L] = SimpleXMLElement Object
(
)

[C] = SimpleXMLElement Object
(
)

)

)

[1] = SimpleXMLElement Object
(
[U] = http://.../benefits/benefits_websites.html
[UD] = http://.../benefits/benefits_websites.html
[UE] = http://.../benefits/benefits_websites.html
[T] = bBenefits/b

[RK] = 9
[CRAWLDATE] =  17 May 2006
[FS] = SimpleXMLElement Object
(
)

[S] = Home, bBenefits/b Forms Jobs Training
Locations, Who We Are E-Info Publicationsbr EVA Team Websites.
bBenefits/b Websites.  b.../b
[LANG] = en
[HAS] = SimpleXMLElement Object
(
[L] = SimpleXMLElement Object
(
)

[C] = SimpleXMLElement Object
(
)

)

[HN] = /benefits
)

[2] = SimpleXMLElement Object
(
[U] = http://www..com/jobs//benefits.html
[UD] = http://www..com/jobs//benefits.html
[UE] = http://www..com/jobs//benefits.html
[T] =  : Jobs :
[RK] = 10
[FS] = SimpleXMLElement Object
(
)

[S] = b.../b bBenefits/b Summary. b.../b
The bBenefits/b of a Unique Culture. Atbr  b.../b success. Medical
Care bBenefits/b. Available after b.../b
[LANG] = en
[HAS] = SimpleXMLElement Object
(
[L] = SimpleXMLElement Object
(
)

[C] = SimpleXMLElement Object
(
)

)

)

Etc..


--
PHP General 

Re: [PHP] Re: Object Array?

2006-05-18 Thread Jay Paulson
This keeps getting stranger and stranger.  I did the var_dump and I got this
for R:

  [R]=
  array(10) {

So it's an array but when I pass it through is_array it says it's not an
array.  However, when I pass it through is_object it says it's an object?!


On 5/18/06 2:18 PM, Daniel Orner [EMAIL PROTECTED] wrote:

 Try using var_dump rather than print_r... maybe it'll give you more
 accurate data (e.g. to figure out if it's an object, as Rob said, or an
 array).
 
 --Daniel
 
 Jay Paulson wrote:
 I tried with no success yesterday to get an answer to this question so I'll
 try again.
 
 I have an object from using simpleXML and inside that object is an array
 holding even more objects.  However, it's not acting like an array and
 therefore I can't go through it. (i.e. I can't use the count function to see
 how big it is and loop through it)
 
 This below should be an array:
 
 $xml-RES-R
 
 When I use print_r($xml-RES-R) I get $xml-RES-R[0] printed, which is
 below:
 
 SimpleXMLElement Object
 (
 [U] = http://.../benefits/
 [UD] = http://.../benefits/
 [UE] = http://.../benefits/
 [T] = bBenefits/b
 
 [RK] = 10
 [CRAWLDATE] =  17 May 2006
 [FS] = SimpleXMLElement Object
 (
 )
 
 [S] = Home, bBenefits/b Forms Jobs Training Locations, Who We Are
 E-Info Publications EVAbr Team Websites. b.../b 2006 bBenefits/b
 Vote. bBenefits/b Links. bBenefits/b Websites. b.../b
 [LANG] = en
 [HAS] = SimpleXMLElement Object
 (
 [L] = SimpleXMLElement Object
 (
 )
 
 [C] = SimpleXMLElement Object
 (
 )
 
 )
 
 )
 
 
 When I use print_r($xml-RES) I get the below.  As you can see [R] = Array
 but yet in the above example it is an object.  I'm so confused and lost.
 Can anyone help?  PHP version 5.0.4
 
 SimpleXMLElement Object
 (
 [M] = 2010
 [FI] = SimpleXMLElement Object
 (
 )
 
 [NB] = SimpleXMLElement Object
 (
 [NU] =
 /search?q=benefitssite=default_collectionhl=enlr=ie=UTF-8output=xml_no_
 dtdclient=default_frontendaccess=psort=date:D:L:d1start=10sa=N
 )
 
 [R] = Array
 (
 [0] = SimpleXMLElement Object
 (
 [U] = http://.../benefits/
 [UD] = http://.../benefits/
 [UE] = http://.../benefits/
 [T] = bBenefits/b
 
 [RK] = 10
 [CRAWLDATE] =  17 May 2006
 [FS] = SimpleXMLElement Object
 (
 )
 
 [S] = Home, bBenefits/b Forms Jobs Training
 Locations, Who We Are E-Info Publications EVAbr Team Websites. b.../b
 2006 bBenefits/b Vote. bBenefits/b Links. bBenefits/b Websites.
 b.../b  
 [LANG] = en
 [HAS] = SimpleXMLElement Object
 (
 [L] = SimpleXMLElement Object
 (
 )
 
 [C] = SimpleXMLElement Object
 (
 )
 
 )
 
 )
 
 [1] = SimpleXMLElement Object
 (
 [U] = http://.../benefits/benefits_websites.html
 [UD] = http://.../benefits/benefits_websites.html
 [UE] = http://.../benefits/benefits_websites.html
 [T] = bBenefits/b
 
 [RK] = 9
 [CRAWLDATE] =  17 May 2006
 [FS] = SimpleXMLElement Object
 (
 )
 
 [S] = Home, bBenefits/b Forms Jobs Training
 Locations, Who We Are E-Info Publicationsbr EVA Team Websites.
 bBenefits/b Websites.  b.../b
 [LANG] = en
 [HAS] = SimpleXMLElement Object
 (
 [L] = SimpleXMLElement Object
 (
 )
 
 [C] = SimpleXMLElement Object
 (
 )
 
 )
 
 [HN] = /benefits
 )
 
 [2] = SimpleXMLElement Object
 (
 [U] = http://www..com/jobs//benefits.html
 [UD] = http://www..com/jobs//benefits.html
 [UE] = http://www..com/jobs//benefits.html
 [T] =  : Jobs :
 [RK] = 10
 [FS] = SimpleXMLElement Object
 (
 )
 
 [S] = b.../b bBenefits/b Summary. b.../b
 The bBenefits/b of a Unique Culture. Atbr  b.../b success. Medical
 Care bBenefits/b. 

Re: [PHP] Re: Object Array?

2006-05-18 Thread Richard Lynch
On Thu, May 18, 2006 2:18 pm, Daniel Orner wrote:
   Try using var_dump rather than print_r... maybe it'll give you more
 accurate data (e.g. to figure out if it's an object, as Rob said, or
 an
 array).

Or not, as it seems to not be very helpful when the object is an
iterator whatever that is -- and I hate it already, even though my
experience with iterator classes is limited to C++ [shudder]

Are there any forks of PHP with all the OO stuff ripped out?... :-v

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php