|
|||||||
| PHP Discussion and technical support for using and deploying PHP based websites. |
![]() |
|
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
Function woes...
I can't remember why, but I know there was something I needed to do to
get my function to grab the variables of my array. Sorry its the end of the day and I'm tired. ![]() PHP Code:
|
|
#2
|
||||
|
||||
|
Your question is a bit ... ambiguous. Are you looking for this?
PHP Code:
__________________
Jon Wire Webmaster and Author of Ridiculousness why is the sun so hot? | fling poo! | Social Bookmarking (BETA (but still really bloody cool)) |
|
#3
|
||||
|
||||
|
Quote:
Something along those lines, unfortunately global $noko doesn't work since $noko is an array. But yeah, that's the gist of it. I use the array $noko a few times with different values, and would like to push those values into my function. If you take that code outside of the function it works great, unfortunately as soon as you stick it inside a function, the array $noko can not pass variables into it. |
|
#4
|
|||
|
|||
|
What is you required the $noko array as a parameter to your function as in: function_name($array_name) and then called your function with function_name($noko);?
|
|
#5
|
||||
|
||||
|
Quote:
http://us2.php.net/manual/en/languag...bles.scope.php
__________________
Jon Wire Webmaster and Author of Ridiculousness why is the sun so hot? | fling poo! | Social Bookmarking (BETA (but still really bloody cool)) Last edited by svidgen; 07-03-2009 at 06:29 PM. Reason: added link |
|
#6
|
||||
|
||||
|
/facepalm I put global outside my function....
I'd thought there was something out of order. I tried it earlier, thought it was incompatible and moved on to something else entirely. I should have read the doc. Quick Question, is there anyway that this might be interfering with my javascript? I just got a weird js error about undefined variables. Last edited by ehime; 07-04-2009 at 12:30 AM. |
|
#7
|
||||
|
||||
|
You put the "GLOBAL" variable you are refering to "INSIDE" the function.
|
|
#8
|
||||
|
||||
|
Yah I figured that out....
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|