Last active
August 29, 2015 13:56
-
-
Save pedro-vasconcelos/9179546 to your computer and use it in GitHub Desktop.
PHP md5 hash trick
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This md5("test\n") is diferent this one md5('test\n') | |
md5("test\n") = 'd8e8fca2dc0f896fd7cb4cb0031ba249' | |
md5('test\n') = 'e55a2a99dcc719bb178a5e6daf3d4f98' | |
Single quoted - strings will display things almost completely "as is." Variables and most escape sequences will not be interpreted. The exception is that to display a literal single quote, you can escape it with a back slash \', and to display a back slash, you can escape it with another backslash \\ (So yes, even single quoted strings are parsed). | |
Double quote - strings will display a host of escaped characters (including some regexes), and variables in the strings will be evaluated. An important point here is that you can use curly braces to isolate the name of the variable you want evaluated. For example let's say you have the variable $type and you what to echo "The $types are" That will look for the variable $types. To get around this use echo "The {$type}s are" You can put the left brace before or after the dollar sign. Take a look at string parsing to see how to use array variables and such. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment