Write a function that takes "depth" as argument and return
sum of node's data of that depth.

For instance,

(0) depth 0
/ \
(10) (20) depth 1
/ \
(40) (50) depth2

If I pass get_sum_by_depth(2) ,

it would return 90 (i.e. 40 + 50 )


No Answer is Posted For this Question
Be the First to Post Answer

Post New Answer

More PHP Interview Questions

Why does php start with variables?

0 Answers  


How can I embed a java program in php file and what changes have to be done in php.ini file?

0 Answers  


how to use http headers inside php? Write the statement through which it can be added?

0 Answers  


Is runtime polymorphism overriding?

0 Answers  


How can cross site request forgery csrf be prevented?

0 Answers  


Why is facebook still using php?

0 Answers  


what is the difference between php and my sql

4 Answers  


Do you know what is the difference between the include() and require() functions?

0 Answers  


Which is the dependent variable?

0 Answers  


Is it possible to submit a form with a dedicated button?

0 Answers  


if i give Limit for mysql query through php command line script like this for ex. $limit=500; $total_items = 1500; for($start=0;$start<$total_items;){ $command = "/usr/bin/php -q /home/sitename/public_html/admin/feedmanager/test.php feedid ".$_GET['feedid']." start ".$start." end ".$limit ; $start = $start+$limit; $command_result = system($command); } so it's execute command for 3 times so it give limit to sql query but if i have 27000 data so it takes long time? so my question is that is that any way from php command line script that i can use for collect all the data at once?

0 Answers  


Without using forms and hidden variables, how to send variables from a PHP script to another URL using POST method?

2 Answers  


Categories