Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

parse_str(3) [php man page]

PARSE_STR(3)								 1							      PARSE_STR(3)

parse_str - Parses the string into variables

SYNOPSIS
void parse_str (string $str, [array &$arr]) DESCRIPTION
Parses $str as if it were the query string passed via a URL and sets variables in the current scope. Note To get the current QUERY_STRING, you may use the variable $_SERVER['QUERY_STRING']. Also, you may want to read the section on vari- ables from external sources. Note The magic_quotes_gpc setting affects the output of this function, as parse_str(3) uses the same mechanism that PHP uses to populate the $_GET, $_POST, etc. variables. PARAMETERS
o $str - The input string. o $arr - If the second parameter $arr is present, variables are stored in this variable as array elements instead. RETURN VALUES
No value is returned. EXAMPLES
Example #1 Using parse_str(3) <?php $str = "first=value&arr[]=foo+bar&arr[]=baz"; parse_str($str); echo $first; // value echo $arr[0]; // foo bar echo $arr[1]; // baz parse_str($str, $output); echo $output['first']; // value echo $output['arr'][0]; // foo bar echo $output['arr'][1]; // baz ?> SEE ALSO
parse_url(3), pathinfo(3), http_build_query(3), get_magic_quotes_gpc(3), urldecode(3). PHP Documentation Group PARSE_STR(3)

Check Out this Related Man Page

LOCALE_PARSE(3) 							 1							   LOCALE_PARSE(3)

Locale::parseLocale - Returns a key-value array of locale ID subtag elements.

	Object oriented style

SYNOPSIS
publicstatic array Locale::parseLocale (string $locale) DESCRIPTION
Procedural style array locale_parse (string $locale) Returns a key-value array of locale ID subtag elements. PARAMETERS
o $locale - The locale to extract the subtag array from. Note: The 'variant' and 'private' subtags can take maximum 15 values whereas 'ext- lang' can take maximum 3 values. RETURN VALUES
Returns an array containing a list of key-value pairs, where the keys identify the particular locale ID subtags, and the values are the associated subtag values. The array will be ordered as the locale id subtags e.g. in the locale id if variants are '-varX-varY-varZ' then the returned array will have variant0=>varX , variant1=>varY , variant2=>varZ EXAMPLES
Example #1 locale_parse(3) example <?php $arr = locale_parse('sl-Latn-IT-nedis'); if ($arr) { foreach ($arr as $key => $value) { echo "$key : $value , "; } } ?> Example #2 OO example <?php $arr = Locale::parseLocale('sl-Latn-IT-nedis'); if ($arr) { foreach ($arr as $key => $value) { echo "$key : $value , "; } } ?> The above example will output: language : sl , script : Latn , region : IT , variant0 : NEDIS , SEE ALSO
locale_compose(3). PHP Documentation Group LOCALE_PARSE(3)
Man Page

15 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

AWK help please

Hi, I have two files each with different record seperators, one with a pipe | and the other with a semi-colon ; How do you deal with this in awk? Any help appreciated specifically i need to change the RS to ; when the following statement operates on the second file (assets.dat) awk... (7 Replies)
Discussion started by: penfold
7 Replies

2. Shell Programming and Scripting

Passing output of sed/echo to a variable

I understand how to use a variable in a sed command, but for the life of me I can't get the output into a variable. I'm making a general function to replace part of a filename with a different string, so: >>myscript this that would change: this_file001.txt to that_file001.txt and... (11 Replies)
Discussion started by: donflamenco
11 Replies

3. Shell Programming and Scripting

String Manipulation Question....

Say I've got a string like: data1,data2,data3,data4. How would I be able to break up the string, so that I have four variables w/ the values data1 data2 data3 data4. Also, how could I read a string character by character. I know you can read a sentence word by word by using the for var... (8 Replies)
Discussion started by: TheRocket
8 Replies

4. UNIX for Dummies Questions & Answers

Storing the output into a variable

Hi unix gurus, I am trying to store the result of a command into a variable. But it is not getting stored. x='hello' y=echo $x | wc -c but it is giving the output as 0(zero) Pls help me its very urgent (7 Replies)
Discussion started by: ravi raj kumar
7 Replies

5. UNIX for Advanced & Expert Users

Weird Awk issue

Hi All, a bit of a weird one here. I'm trying to pass a variable into an awk command, and I keep getting an error. I have the line nawk -F"," -v red=$random_variable '{print $red}' $w_dir/$file_name > $w_dir/${column_name} that keeps failing with the error nawk: can't open file {print... (17 Replies)
Discussion started by: Khoomfire
17 Replies

6. UNIX for Dummies Questions & Answers

math in unix

I have 2 variables a=2 b=1 i want to add a and b how do i do this in unix using just the echo command and by assigning it to a different variable like c? (13 Replies)
Discussion started by: khestoi
13 Replies

7. Shell Programming and Scripting

awk script to split field data

Hi Experts, I have a Input.txt document which contains data fields seperated by tabs. There are 4 fields totally Named UNIQUE, ORDER, CONTACT and WINS. The UNIQUE field contains unique ID and the CONTACT field contains data seperated by comma in some records. I am looking to write an awk script... (12 Replies)
Discussion started by: forumthreads
12 Replies

8. Shell Programming and Scripting

bash Script: Issue with iterating Directory and store into array

Hi all, I am working on a backup based script, in which it enters to a directory and check the sub-directories and copy the names into an array. cd $CPFs k=0 for i in * do if then ARRs="$i" k=$(($k+1)) #echo "$i" ... (19 Replies)
Discussion started by: canishk
19 Replies

9. Shell Programming and Scripting

help - exec time too long

Dear everyone... thanks to this forum I am able to do everyday more and more complex scripts...but now I come up with problem with optimisation.. problem 1 - optimise: here is my code: while read number do nawk -F "|" -v... (8 Replies)
Discussion started by: abdulaziz
8 Replies

10. UNIX for Dummies Questions & Answers

Breaking a string into four different numbers

I'm having trouble breaking a string into four different numbers. What I'm starting out with is foo='1218141 1441 1664 122222' and what I want to have is a=1218141 b=1441 c=1664 d=122222 I'm tried using some pattern matching to break the string up into these four different... (7 Replies)
Discussion started by: Azumandious
7 Replies

11. UNIX for Dummies Questions & Answers

Condition for decimal numbers

Hi experts, My number output has somehting like below filename /temp 0.23 10.23 How do i put a condition to the above numbers? e.g if then the . seem to give me problems. Pls help. thanks ---------- Post updated at 05:25 PM ---------- Previous update was at 05:23 PM... (9 Replies)
Discussion started by: streddy
9 Replies

12. Shell Programming and Scripting

Reverse of a string

Hi All, I have a String str="Manish". I would like to reverse it. I know the option to do this in bash is: echo "Manish" | rev but I have seen an alternate solution somewhere, which states that: str="Manish" echo $str | awk '{ for(i=length($0);i>=1;i--) printf("%s",substr($0,i,1));... (7 Replies)
Discussion started by: manishdivs
7 Replies

13. Shell Programming and Scripting

Disk report generation problem

Hello everyone, I have a list of inputs as below. My logic is to get the particular powerdisk which matches for ASM disk which means take the major & minor number of each asm disk and matches with powerdisk info then get the particular powerdisk $ ls -l /dev/asm_* ---> ASM disk info... (11 Replies)
Discussion started by: kannan84
11 Replies

14. Shell Programming and Scripting

Using unix array in sql

Hi all, I have declared an array in unix as below. #!/bin/ksh arr=() for i in {0..4} do arr=$i; done. i want to insert these array variables into the oracle table.can you guys please help me in doing this. my code is as below. value=`sqlplus -s fos/fos << EOF begin for j in... (10 Replies)
Discussion started by: Mukta
10 Replies

15. Programming

Integer array length

Hello; When I wrote a function to print out an array, void p_array(int arr) { int i; int size = sizeof(arr) / sizeof(int); // int size = sizeof (arr) / sizeof (arr); for (i = 0; i < size; i++) printf("%d ", arr); printf("\n"); }I could only print out the... (19 Replies)
Discussion started by: yifangt
19 Replies