how to get the last child in an array and set last child to it.
In python we can write to get lastchild's last child in contents array and set lastchild to it.
lastChild = lastChild.contents[-1]
but in php
//is it proper way to do same thing or any better way.
Well, you could do that, but those functions:
Whilst we do have the last child there in our variable, the
Please take a look at my article on an internal pointers here: http://www.talkphp.com/vbarticles.ph...ents-in-arrays
So, how to get the last child without modifying the internal pointer? Well, we could do the following, which would work in a similar way to Python's:
The minus one (-1) being necessary because count doesn't start at zero, whereas array keys do.
|All times are GMT. The time now is 05:01 AM.|
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0