| | |
Problem with Function in Araay
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
Hi all,
I Have a Problem in my Function. I am created a Recursion Function in PHP and also Created a Array.
But I Have a Trouble That How to Store This Recursion Function Value in Array.
Please Help Me I Want to Store Recursion Function Value in PHP and Print it Our of Loop.
Please Help.
Thanx.
I Have a Problem in my Function. I am created a Recursion Function in PHP and also Created a Array.
But I Have a Trouble That How to Store This Recursion Function Value in Array.
Please Help Me I Want to Store Recursion Function Value in PHP and Print it Our of Loop.
Please Help.
Thanx.
http://www.kuchamancity.com
Hem Web Solution..
Behind Every Successful Man, There is an Untold Pain in His Heart.
Hem Web Solution..
Behind Every Successful Man, There is an Untold Pain in His Heart.
0
#2 Nov 1st, 2009
To add an item to an array, do this:
Then to print out the entire array:
If that is not what you want then post an example of your code.
PHP Syntax (Toggle Plain Text)
$array_name[] = 'Value';
Then to print out the entire array:
PHP Syntax (Toggle Plain Text)
foreach($array_name as $key => $value) { echo $value . "<br />"; }
If that is not what you want then post an example of your code.
AJAX is not a programming language, scripting language or any other sort of language.
It is acheived by using JavaScript http functions.
So, AJAX = JavaScript.
It is acheived by using JavaScript http functions.
So, AJAX = JavaScript.
0
#3 Nov 1st, 2009
Hey.
To add to an array from withing a recursive function, you need to either import a global variable into the function, or pass it as a reference parameter.
I would recommend the second option, because it gives you more control over how the variables are handled.
If this is not what you are talking about, please explain this better. Code examples are also very helpful.
To add to an array from withing a recursive function, you need to either import a global variable into the function, or pass it as a reference parameter.
php Syntax (Toggle Plain Text)
$myArray = array(); function setValue($value) { if($value < 100) { global $myArray; $myArray[] = $value; setValue($value+1); } }
php Syntax (Toggle Plain Text)
function setValue($value, &$myArray) { if($value < 100) { $myArray[] = $value; setValue($value+1); } } $myArray = array(); setValue(1, $myArray);
If this is not what you are talking about, please explain this better. Code examples are also very helpful.
Please do not ask for help in a PM. Use the forums.
And use [code] tags!
And use [code] tags!
![]() |
Other Threads in the PHP Forum
- Previous Thread: PHP Error on line
- Next Thread: send link to another server
Views: 607 | Replies: 2
| Thread Tools | Search this Thread |
Tag cloud for array, function, php
access ajax array arrays asp beginner buttons c# c++ char cheap class cms convert corrupted counttheoccurenceofanintegerinthe10inputs curl data database date delete display dojofoundation dynamic email file files flash form forms frequency function functions graph histogram html image include index input insert integration java javascript jquery lamp limit link linux list listbox login mail math menu methods multiple mysql number object oop overwrite paypal perl php physics pointer post problem programmer programming python query random recursion recursive ruby script search security session sms soap spam sql string tutorial upload user validation variable vb vbulletin video web webdesign winforms xml youtube zend






