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)
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)
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)
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)
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)
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)
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)
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)
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)
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
compact
COMPACT(3) 1 COMPACT(3)compact - Create array containing variables and their valuesSYNOPSIS
array compact (mixed $varname1, [mixed $...])
DESCRIPTION
Creates an array containing variables and their values.
For each of these, compact(3) looks for a variable with that name in the current symbol table and adds it to the output array such that
the variable name becomes the key and the contents of the variable become the value for that key. In short, it does the opposite of
extract(3).
Any strings that are not set will simply be skipped.
PARAMETERS
o $varname1
-compact(3) takes a variable number of parameters. Each parameter can be either a string containing the name of the variable, or
an array of variable names. The array can contain other arrays of variable names inside it; compact(3) handles it recursively.
RETURN VALUES
Returns the output array with all the variables added to it.
EXAMPLES
Example #1
compact(3) example
<?php
$city = "San Francisco";
$state = "CA";
$event = "SIGGRAPH";
$location_vars = array("city", "state");
$result = compact("event", "nothing_here", $location_vars);
print_r($result);
?>
The above example will output:
Array
(
[event] => SIGGRAPH
[city] => San Francisco
[state] => CA
)
NOTES
Note
Gotcha
Because variable variables may not be used with PHP's Superglobal arrays within functions, the Superglobal arrays may not be passed
into compact(3).
SEE ALSO extract(3).
PHP Documentation Group COMPACT(3)