Increment behavior on strings - PHP easter egg?
PHP follows Perl's convention when dealing with arithmetic operations
on character variables and not C's. For example, in PHP and Perl $a =
'Z'; $a++; turns $a into 'AA', while in C a = 'Z'; a++; turns a into
'[' (ASCII value of 'Z' is 90, ASCII value of '[' is 91). Note that
character variables can be incremented but not decremented and even so
only plain ASCII characters (a-z and A-Z) are supported.
Incrementing/decrementing other character variables has no effect, the
original string is unchanged.
-> http://php.net/manual/en/language.operators.increment.php
PHP Increase string value
you can try this regular expression. This snippet works and it gave me result as someString_2
$string = "someString_1";
function increment($matches) {
return ++$matches[1];
}
echo $string = preg_replace_callback( "|(\d+)|", "increment", $string);
PHP Echo char variable mistake
Take a look at what PHP documentation says about incrementing characters:
PHP follows Perl's convention when dealing with arithmetic operations
on character variables and not C's. For example, in PHP and Perl $a =
'Z'; $a++; turns $a into 'AA', while in C a = 'Z'; a++; turns a into
'[' (ASCII value of 'Z' is 90, ASCII value of '[' is 91). Note that
character variables can be incremented but not decremented and even so
only plain ASCII characters (a-z and A-Z) are supported.
Incrementing/decrementing other character variables has no effect, the
original string is unchanged.
How can I disable PHP's easter egg URLs?
A quick HTACCESS global rewrite could regex the exact string right out of every URL thus getting rid of the only fun part of PHP without touching the ini file nor needing a function at the beginning of every file.
Haven't tested this yet, but this should work:
RewriteEngine On
RewriteCond %{QUERY_STRING} \PHPE9568F36-D428-11d2-A769-00AA001ACF42\ [NC]
RewriteRule .* - [F]
Of course, just copy the last 2 lines for each of the other possible queries, or write a more generic regex. I'm not good with regex. :)
This version covers all of the easter egg fun and was found here:
RewriteEngine On
RewriteCond %{QUERY_STRING} \=PHP[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12} [NC]
RewriteRule .* - [F]
How to display reporting services record set in a collection of textboxes
I found it
right click the textbox
select expressions
select dataset
select your dataset
select First([fieldname])
voila
Related Topics
Regex for Dropping Http:// and Www. from Urls
Installing Mcrypt on Osx 10.8.2 - PHP 5.3.15 with Homebrew
Processing Multidimensional JSON Array with PHP
Ignoring Errors in File_Get_Contents Http Wrapper
In Htaccess, I'D Like to Replace Underscores with Hyphens and Then Redirect the User the New Url
Find Min/Max in a Two Dimensional Array
How to Get the Shortest Rather Than Longest Possible Regex Match with Preg_Match()
What Is the Easiest Way to Use the Head Command of Http in PHP
Php, Why Do You Escape My Quotes
PHP Curl: How to Set Body to Binary Data
SQL Server Error 1934 Occurs on Insert to Table with Computed Column PHP/Pdo
Why Does an Infinitely Recursive Function in PHP Cause a Segfault
Mongodb Get _Id as String in Find Query
How to Tell Apart Simplexml Objects Representing Element and Attribute