07-02-2011
Probably because of incorrect variable scope. See
PHP: Variable scope. You are using $aid outside the loop.
This User Gave Thanks to fpmurphy For This Post:
10 More Discussions You Might Find Interesting
1. Programming
Hi
I am passing or want to pass value of a char array, so that even thoug the called routine is changing the values the calling function should not see the values changed, meaning only copy should be passed
Here is the program
#include<iostream.h>
#include<string.h>
void f(char a);
int... (5 Replies)
Discussion started by: rkraj
5 Replies
2. Shell Programming and Scripting
I am doing a shell script in ksh. I have an output from grep that goes something like this:
wordIWasLookingFor
anotherWordIWasLookingFor
yetAnotherWordIWasLookingFor
I want to toss each line into an array such that:
myArray = wordIWasLookingFor
myArray = anotherWordIWasLookingFor... (3 Replies)
Discussion started by: mrwatkin
3 Replies
3. Shell Programming and Scripting
Hi,
I'm trying to write a function that reassigns an array to
another local array but the method used in reassigning
the array reformats the contents of the array which is
what I am trying to prevent.
The method used to load a file into an array works as
expected and the entire array is... (4 Replies)
Discussion started by: ASGR
4 Replies
4. Programming
Hi.
I have a problem with passing two dimensional array to a function.
First, let me show my code to explain what i am going to do:
I have function:void initialize_board(char board);which is supposed to modify content of passed array. I have read here: Question 6.18 how such arrays should be... (3 Replies)
Discussion started by: Shang
3 Replies
5. Shell Programming and Scripting
Dears,
Newbie here and tried to search this topic for 3 days now with results.
I have a shell array and I want to use it in sqlplus with one connection.
here is what I have for now
#!/bin/ksh
FileName=1000
FileName=2000
FileName=3000
FileName=4000
sqlplus /nolog <<EOF
connect... (20 Replies)
Discussion started by: roby2411
20 Replies
6. Shell Programming and Scripting
I'm trying to use the following command:
awk -v array1=${array1} -f "filename.awk" input.txt
Then within filename.awk I want to access array1. However, awk mistakes array1 (the third element of the array) for the input file. How I can pass awk this array?
It also appears that awk scripts... (3 Replies)
Discussion started by: B-Ry
3 Replies
7. Shell Programming and Scripting
Good grief so this should be easy. Passing an array as an argument to a function. Here is the sample code:
#/bin/bash
function foo {
local p1=${1}
local p2=(${2})
local p3=${3}
echo p1 is $p1
echo p2 is $p2
echo p3 is $p3
}
d1=data1
d2=data2
a=(bat bar baz) (2 Replies)
Discussion started by: brsett
2 Replies
8. UNIX for Dummies Questions & Answers
i have a list of apps that i need to forcequit and, from time to time, that list changes. perfect excuse to manage a single array! however, my strings with spaces aren't passing as i'd like them to. here's the simple script:
#!/bin/sh
#-----Array
apps=( firefox-bin firefox... (6 Replies)
Discussion started by: hungryd
6 Replies
9. UNIX for Advanced & Expert Users
I have a below syntax its working fine...
var12=$(ps -ef | grep apache | awk '{print $2,$4}')
Im getting expected output as below:
printf "%b\n" "${VAR12}"
dell 123
dell 456
dell 457
Now I wrote a while loop.. the output of VAR12 should be passed as input parameters to while loop and results... (5 Replies)
Discussion started by: sam@sam
5 Replies
10. UNIX for Beginners Questions & Answers
I am trying to pass parameters to a script which will accept them in array.
First parameter is where_clause
second parameter is "SRC_TYPE='SYBASE' and PROCESS_CD='BRK'"
}
echo $2
$ ./abcd.ksh where_clause "SRC_TYPE='SYBASE' and PROCESS_CD='BRK'"
+ set -A arg_list -- where_clause... (3 Replies)
Discussion started by: ratheeshjulk
3 Replies
LEARN ABOUT PHP
runkit_sandbox_parent
RUNKIT_SANDBOX_PARENT(3) 1 RUNKIT_SANDBOX_PARENT(3)
Runkit_Sandbox_Parent - Runkit Anti-Sandbox Class
SYNOPSIS
void Runkit_Sandbox_Parent::__construct (void )
DESCRIPTION
Instantiating the Runkit_Sandbox_Parent class from within a sandbox environment created from the Runkit_Sandbox class provides some (con-
trolled) means for a sandbox child to access its parent.
Note
Sandbox support (required for runkit_lint(3), runkit_lint_file(3), and the Runkit_Sandbox class) is only available as of PHP 5.1.0
or specially patched versions of PHP 5.0, and requires that thread safety be enabled. See the README file included in the runkit
package for more information.
In order for any of the Runkit_Sandbox_Parent features to function. Support must be enabled on a per-sandbox basis by enabling the par-
ent_access flag from the parent's context.
Example #1
Working with variables in a sandbox
<?php
$sandbox = new Runkit_Sandbox();
$sandbox['parent_access'] = true;
?>
ACCESSING THE PARENT'S VARIABLES
Just as with sandbox variable access, a sandbox parent's variables may be read from and written to as properties of the Runkit_Sand-
box_Parent class. Read access to parental variables may be enabled with the parent_read setting (in addition to the base parent_access set-
ting). Write access, in turn, is enabled through the parent_write setting.
Unlike sandbox child variable access, the variable scope is not limited to globals only. By setting the parent_scope setting to an appro-
priate integer value, other scopes in the active call stack may be inspected instead. A value of 0 (Default) will direct variable access at
the global scope. 1 will point variable access at whatever variable scope was active at the time the current block of sandbox code was exe-
cuted. Higher values progress back through the functions that called the functions that led to the sandbox executing code that tried to
access its own parent's variables.
Example #2
Accessing parental variables
<?php
$php = new Runkit_Sandbox();
$php['parent_access'] = true;
$php['parent_read'] = true;
$test = "Global";
$php->eval('$PARENT = new Runkit_Sandbox_Parent;');
$php['parent_scope'] = 0;
one();
$php['parent_scope'] = 1;
one();
$php['parent_scope'] = 2;
one();
$php['parent_scope'] = 3;
one();
$php['parent_scope'] = 4;
one();
$php['parent_scope'] = 5;
one();
function one() {
$test = "one()";
two();
}
function two() {
$test = "two()";
three();
}
function three() {
$test = "three()";
$GLOBALS['php']->eval('var_dump($PARENT->test);');
}
?>
The above example will output:
string(6) "Global"
string(7) "three()"
string(5) "two()"
string(5) "one()"
string(6) "Global"
string(6) "Global"
CALLING THE PARENT'S FUNCTIONS
Just as with sandbox access, a sandbox may access its parents functions providing that the proper settings have been enabled. Enabling
parent_call will allow the sandbox to call all functions available to the parent scope. Language constructs are each controlled by their
own setting: print(3) and echo(3) are enabled with parent_echo. die(3) and exit(3) are enabled with parent_die. eval(3) is enabled with
parent_eval while include(3), include_once(3), require(3), and require_once(3) are enabled through parent_include.
PHP Documentation Group RUNKIT_SANDBOX_PARENT(3)