Latest Uploads
Extraterre ... .0.1 (zip)

dantheman363

Monty Teas ... Screenie 1

steve_ancell

Santa Clau ... ed his bag

waroffice

manic_platdude.png

spinal

Tetris Clone

steve_ancell

Super blues bros.

spinal

Forum Home

PHP missing array grandchild

UserMessage
Posted : Friday, 23 September 2011, 04:37 | Permalink | Mark Here
HoboBen


WW Entries : 9
I have some code for building a HTML table from PHP.

-->

Usage:
-->

And the result:
-->

If you note, var_dump($tr) correctly dumps the <tr>, including child <td> elements.

However, var_dump($table), while correctly var_dumping the <tr> elements, does not var_dump the grandchild <td> elements -- note the empty array ["td"]=> array(0) { }

Do you know why this might be happening?

Thanks

-----
github
Posted : Saturday, 24 September 2011, 04:29 | Permalink | Mark Here
HoboBen


WW Entries : 9
I got an excellent answer on StackOverflow, which explains the problem.

Sigh, why can't everything use C-style pointers? I hate it when PHP does "magic".

-----
github
Posted : Sunday, 25 September 2011, 03:19 | Permalink | Mark Here
JL235


WW Entries : 7
What version of PHP are you using?

It's my understanding that PHP uses references instead of copying in recent versions (at least in 5.3).

-----
PlayMyCode.com - build and play in your browser, Blog, Twitter.
Posted : Sunday, 25 September 2011, 12:32 | Permalink | Mark Here
HoboBen


WW Entries : 9
5.3.3 on my laptop (where I ran the code) slightly older on the server.

-->

It was a great answer though: the ampersand in the function definition was something I didn't know how to do in PHP. It solved the immediate problem and also taught me how to apply this to other situations.

-----
github
Latest Posts
Consumer Lockout
9572AD Thu 06:09
Professor Oak, Honest!!
spinal Wed 23:24
Position in Mind
steve_ancell Wed 20:11
Sonic Adventure v0.x
Jayenkai Wed 07:08
Coder's Block
Jayenkai Wed 06:03
FIRST!!!
steve_ancell Wed 03:55
Noel's Graduation
waroffice Wed 02:55
Monkey vs iOS tweaks
spinal Tue 22:51
Fucking Pound Sign Unicode Bullshit Bollocks
Dabz Tue 13:00
Progress / Location Bars
dna Tue 08:55
More

Latest Items
News : Newsletter #176
Jayenkai Sat 04:49
News : Newsletter #175
Dabz Tue 09:38
Blog : Snow: More Material Junk
Cower Sat 23:17
Dev-Diary : Mutant Monty: Amstrad CPC to Windows conversion
rockford Fri 13:14
Techy : AppleTV
Jayenkai Thu 09:40
Blog : Graphviz
steve_ancell Sat 14:17
Pets : Top-Down Shadow Hack
Jayenkai Tue 05:52
Snippet : JNKrunch v1.0
Jayenkai Sat 07:20
News : Newsletter #173
waroffice Fri 04:47
Blog : Material Loading
Cower Fri 02:08
Pets : I Done Won A Thing
shroom_monk Sun 11:31
Pets : Repurposing A Lexer
Cower Mon 22:06
Bah : Feeling a Little Angry
spinal Mon 11:26
News : Newsletter #170
Dabz Sat 00:34
Showcase : sbfgen
Cower Sat 16:57
More

Who's Online
Krakatomato
Thu, at 07:00
Dabz
Thu, at 06:55
spinal
Thu, at 06:45
9572AD
Thu, at 06:13
shroom_monk
Thu, at 05:16
Jayenkai
Thu, at 05:13
steve_ancell
Thu, at 05:07
rockford
Thu, at 03:55
CodersRule
Thu, at 03:49
Cower
Thu, at 00:50
Link to this page
Site : Jayenkai 2006-Infinity |
MudChat's origins, BBCode's former life, Image Scaler.