Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

collator_asort(3) [php man page]

COLLATOR_ASORT(3)							 1							 COLLATOR_ASORT(3)

Collator::asort - Sort array maintaining index association

       Object oriented style

SYNOPSIS
public bool Collator::asort (array &$arr, [int $sort_flag]) DESCRIPTION
Procedural style bool collator_asort (Collator $coll, array &$arr, [int $sort_flag]) This function sorts an array such that array indices maintain their correlation with the array elements they are associated with. This is used mainly when sorting associative arrays where the actual element order is significant. Array elements will have sort order according to current locale rules. Equivalent to standard PHP asort(3). PARAMETERS
o $coll -Collator object. o $arr -Array of strings to sort. o $sort_flag - Optional sorting type, one of the following: o Collator::SORT_REGULAR - compare items normally (don't change types) o Collator::SORT_NUMERIC - compare items numerically o Collator::SORT_STRING - compare items as strings Default $sort_flag value is Collator::SORT_REGULAR. It is also used if an invalid $sort_flag value has been specified. RETURN VALUES
Returns TRUE on success or FALSE on failure. EXAMPLES
Example #1 collator_asort(3)example <?php $coll = collator_create( 'en_US' ); $arr = array( 'a' => '100', 'b' => '50', 'c' => '7' ); collator_asort( $coll, $arr, Collator::SORT_NUMERIC ); var_export( $arr ); collator_asort( $coll, $arr, Collator::SORT_STRING ); var_export( $arr ); ?> The above example will output: array ( 'c' => '7', 'b' => '50', 'a' => '100', )array ( 'a' => '100', 'b' => '50', 'c' => '7', ) SEE ALSO
Collator constants, collator_sort(3), collator_sort_with_sort_keys(3). PHP Documentation Group COLLATOR_ASORT(3)

Check Out this Related Man Page

COLLATOR_GET_LOCALE(3)							 1						    COLLATOR_GET_LOCALE(3)

Collator::getLocale - Get the locale name of the collator

	Object oriented style

SYNOPSIS
public string Collator::getLocale (int $type) DESCRIPTION
Procedural style string collator_get_locale (Collator $coll, int $type) Get collector locale name. PARAMETERS
o $coll -Collator object. o $type - You can choose between valid and actual locale ( Locale::VALID_LOCALE and Locale::ACTUAL_LOCALE, respectively). RETURN VALUES
Real locale name from which the collation data comes. If the collator was instantiated from rules or an error occurred, returns boolean FALSE. EXAMPLES
Example #1 collator_get_locale(3) example <?php $coll = collator_create( 'en_US_California' ); $res_val = collator_get_locale( $coll, Locale::VALID_LOCALE ); $res_act = collator_get_locale( $coll, Locale::ACTUAL_LOCALE ); printf( "Valid locale name: %s Actual locale name: %s ", $res_val, $res_act ); ?> The above example will output: Requested locale name: en_US_California Valid locale name: en_US Actual locale name: en SEE ALSO
collator_create(3). PHP Documentation Group COLLATOR_GET_LOCALE(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. UNIX for Dummies Questions & Answers

to assign cut values to an array

i need to seperate values seperated by delimiters and assign it to an array.. can u plz help me on that. Variables = "asd,rgbh,(,rty,got,),sroe,9034," i need to assign the variables into arrays.. like.. var=asd var=rgbh.. and so on how do i do this. i need to reuse the values stored in... (6 Replies)
Discussion started by: Syms
6 Replies

3. Shell Programming and Scripting

Shel program file handling

Hi, Iam having the file as follows: QWASEDRF1234567890098765 abc@quebex.com 000000000-932333 678394-56=3 9033894 QWASEDRF1234567890098765 abc@quebex.com 000000000-932333 678394-56=3 9033894 OPIUYTREE0986666544443322 dcsx@olivaa.net ... (14 Replies)
Discussion started by: nivas
14 Replies

4. Programming

Sorting in C++..

Hi, I need to do a sorting of 2 arrays. One array contains the values of both integer and character and other array can be anything. For example: Array={'1L','2C','NULL','23L','11L','4C','10L','9C'} Array= {'01-02-13-1x','02-11-23-3s','00-12-13-5f','NULL','22k',} If any of these arrays... (6 Replies)
Discussion started by: ronix007
6 Replies

5. Shell Programming and Scripting

Why do we use sort before compare ?

Dear All. Im trying to know how exactly the command "compare" works, does it compare line by line or field by field, and the most important thing is that why the files have to be sorted before we compare them? Thanks in advance (7 Replies)
Discussion started by: yahyaaa
7 Replies

6. 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

7. 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

8. Shell Programming and Scripting

PERL : Sort substring occurrences in array of strings

Hi, My developer is on vacation and I am not sure if there is something which is easier for this. I have an array of strings. Each string in the array has "%" characters in it. I have to get the string(s) which have the least number of "%" in them. I know how I can get occurrences : ... (7 Replies)
Discussion started by: sinpeak
7 Replies

9. 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

10. Shell Programming and Scripting

Data Normalization

Hi, there Need help on rearranging the data. I have data in the following format. LAC = 040 DN = 24001001 EQN = 920- 2- 0- 1 CAT = MS OPTRCL (7 Replies)
Discussion started by: meetsriharsha
7 Replies

11. 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

12. UNIX for Dummies Questions & Answers

Arrays

Am using bash For eg: Suppose i have a array arr=(1 2 3 4 5 6 7 8 9 10 11 12) suppose i give input 5 to a script and script should able to print values greater than or equal to 5 like below: Input: 5 output: 5,6,7,8,9,10,11,12 (7 Replies)
Discussion started by: manid
7 Replies

13. Shell Programming and Scripting

Multidimensional array:awk error

awk -F'\t' -v OFS='\t' ' { if($2 in arr) { #print "Sahi", NR,arr for(k=2;k<=NF;k++){ # sum]+=$2 } } else { arr=NR #print "awk",NR for (k=3;k<=NF ; k++){ sum=$k } } } (7 Replies)
Discussion started by: genome
7 Replies

14. UNIX for Beginners Questions & Answers

Array length: ls and sort

Hi there, I'm listing files and sorting them. When I try to get length of array variable in which these files are stored I get 1 as value. That's weird. files_info="$(find $input_dir -name "*_CHR$i.info" | sort )" printf ${#files_info}"\n" #print length #--loop through... (6 Replies)
Discussion started by: genome
6 Replies

15. UNIX for Beginners Questions & Answers

Need a Bash script for iterating thru an array and running a command

Hi , I am a total beginner so bear with me. I have the below code which works . I need to extend it by iterating thru the array arr and executing a command in each loop. some thing on the lines of below. I need to run this in a Jenkins script , so I would need below bash script to run... (6 Replies)
Discussion started by: SVRao19056
6 Replies