Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

apc_cas(3) [php man page]

APC_CAS(3)								 1								APC_CAS(3)

apc_cas - Updates an old value with a new value

SYNOPSIS
bool apc_cas (string $key, int $old, int $new) DESCRIPTION
apc_cas(3) updates an already existing integer value if the $old parameter matches the currently stored value with the value of the $new parameter. PARAMETERS
o $key - The key of the value being updated. o $old - The old value (the value currently stored). o $new - The new value to update to. RETURN VALUES
Returns TRUE on success or FALSE on failure. EXAMPLES
Example #1 apc_cas(3) example <?php apc_store('foobar', 2); echo '$foobar = 2', PHP_EOL; echo '$foobar == 1 ? 2 : 1 = ', (apc_cas('foobar', 1, 2) ? 'ok' : 'fail'), PHP_EOL; echo '$foobar == 2 ? 1 : 2 = ', (apc_cas('foobar', 2, 1) ? 'ok' : 'fail'), PHP_EOL; echo '$foobar = ', apc_fetch('foobar'), PHP_EOL; echo '$f__bar == 1 ? 2 : 1 = ', (apc_cas('f__bar', 1, 2) ? 'ok' : 'fail'), PHP_EOL; apc_store('perfection', 'xyz'); echo '$perfection == 2 ? 1 : 2 = ', (apc_cas('perfection', 2, 1) ? 'ok' : 'epic fail'), PHP_EOL; echo '$foobar = ', apc_fetch('foobar'), PHP_EOL; ?> The above example will output something similar to: $foobar = 2 $foobar == 1 ? 2 : 1 = fail $foobar == 2 ? 1 : 2 = ok $foobar = 1 $f__bar == 1 ? 2 : 1 = fail $perfection == 2 ? 1 : 2 = epic fail $foobar = 1 SEE ALSO
apc_dec(3), apc_store(3). PHP Documentation Group APC_CAS(3)

Check Out this Related Man Page

BASENAME(3)								 1							       BASENAME(3)

basename - Returns trailing name component of path

SYNOPSIS
string basename (string $path, [string $suffix]) DESCRIPTION
Given a string containing the path to a file or directory, this function will return the trailing name component. PARAMETERS
o $path - A path. On Windows, both slash ( /) and backslash ( ) are used as directory separator character. In other environments, it is the forward slash ( /). o $suffix - If the name component ends in $suffix this will also be cut off. RETURN VALUES
Returns the base name of the given $path. EXAMPLES
Example #1 basename(3) example <?php echo "1) ".basename("/etc/sudoers.d", ".d").PHP_EOL; echo "2) ".basename("/etc/sudoers.d").PHP_EOL; echo "3) ".basename("/etc/passwd").PHP_EOL; echo "4) ".basename("/etc/").PHP_EOL; echo "5) ".basename(".").PHP_EOL; echo "6) ".basename("/"); ?> The above example will output: 1) sudoers 2) sudoers.d 3) passwd 4) etc 5) . 6) NOTES
Note basename(3) operates naively on the input string, and is not aware of the actual filesystem, or path components such as " ..". Note basename(3) is locale aware, so for it to see the correct basename with multibyte character paths, the matching locale must be set using the setlocale(3) function. SEE ALSO
dirname(3), pathinfo(3). PHP Documentation Group BASENAME(3)
Man Page

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Combining Two Dirs

I have two Directories, foo and foobar. I want to combine the contents of foo into foobar. There is probably a simple command for this, but I have yet to find it. Thanks in advance, Robert (2 Replies)
Discussion started by: Phobos
2 Replies

2. UNIX for Dummies Questions & Answers

ambiguous redirect

i have following statement in the script echo -e "$str_XML_col_name:$str_field_type;" >> $i_DC_Key_$i_Tgt_DC_key_Schema here $i_DC_Key is DC key and $i_Tgt_DC_key are the variables............... when i ran the script i am getting error rec_merge.sh: $i_DC_Key_$i_Tgt_DC_key_Schema:... (1 Reply)
Discussion started by: mahabunta
1 Replies

3. UNIX for Dummies Questions & Answers

To publish xml in a textarea

Hi everyone, When I use echo "<textarea cols ="75" rows ="20" align="center">" echo |cat xyz.sh echo "</textarea>" I am able to view the file xyz.sh in the text area but when I try to echo an xml echo "<textarea cols ="75" rows ="20" align="center">" echo |cat xml.txt echo... (3 Replies)
Discussion started by: Kashnaz
3 Replies

4. Shell Programming and Scripting

store key value

Hi All, I have a string like echo $var D_PROC=20080723 I_REPROC=N C_TYPE_FILE=INBOUND Now I want it be stored in an associative array so that when we echo $arr it should be 20080723 (5 Replies)
Discussion started by: thana
5 Replies

5. Shell Programming and Scripting

decimal calculation

Hi am calculating the percentage of the pass and fail. Pass: echo `echo 1498*100/1667| bc`% fail: echo `echo 169*100/1667 | bc`% for this am getting PASS= 89% fail =10 % I need to fetch the exact decimal percentage like PASS = 89.8 % FAIL= 10.2 % Please advice me (3 Replies)
Discussion started by: bobprabhu
3 Replies

6. Shell Programming and Scripting

formatting files

how do i add the directory name to multiple flies and pad numbers sequences /bin/bin2/bin3/bin4/bin5/foo_bar_vX/foobar ie i have a pic in the foobar folder call dsc.1 id like to change it to foobar_dsc.0001 (2 Replies)
Discussion started by: thehive
2 Replies

7. UNIX for Dummies Questions & Answers

Need help in scripting

Hi, I have a file which is having some contents, in that I want to grep for 3 particular patterns. If all the 3 patterns are present then I like to echo success else echo failure. Could you please help me how we can do this unix script. Thanks, (1 Reply)
Discussion started by: senor.ram
1 Replies

8. Programming

while loop perl

I am trying to create a success and fail as below in a perl script : while echo$? is 2 it should append as below to .fail file ===================== if ( open(IN, "$outputfile")) { while( $my_line = <IN> ) { #print "$my_line \n" ; return 0; ... (3 Replies)
Discussion started by: sriram003
3 Replies

9. Shell Programming and Scripting

Can we echo something for "down key"

I know echo -e "\n" is Enter, but how about "down key" or "up key" in bash (8 Replies)
Discussion started by: yanglei_fage
8 Replies

10. UNIX for Advanced & Expert Users

Full System Recursive Search for a String - Not Finishing

Using grep -r -H "foobar" / > result to give all files that contain the string "foobar" Half way , its waiting for some thing and does not end Not Sure whats happening. Any help is much appreciated Thank you (2 Replies)
Discussion started by: shorn
2 Replies