Strings
IT Notes → PHP @ December 22, 2020
- Serialize(), deserialize(), urlencode() and urldecode().
- For % the result has same sign as the first operator.
- Reference operator =& and reference parameter ¶m in signature.
- $f = func1() or func2(); => ($f = func1()) || func2(); which means func2() executes only if func1() returns false. Example: $f=func() or die(); // Remember to put $f.
- Similarly, $f = func1() and func2(); means func2() executes only if func1() returns true.
- The Execution Operator [Backticks ` (left to 1)].
- Variable functions: $func(49);
- If we set mbstring.func_overload =1 or 2 or 4 or combination in php.ini settings then we can overload 1 (“mail”) + 2 (“str”) + 4 (“ereg”) with its multibyte counterpart. So strpos will work as mb_strpos which will perform operation on even non-ASCII text.
- call_user_func(func, para1 …) and call_user_func_array(func, array) => Call Back Functions. If array each element is a parameter. Another way of function call.
- connection_status( ) tells client status. CONNECTION_NORMAL => 1, CONNECTION_ABORTED => 2, CONNECTION_TIMEOUT => 3.
- escapeshellcmd( ) To prevent/reduce risk in shell execution through PHP.
- string exec (string command [, array &output [, int &return_val]]).
- bool function_exists (string function_name ).
- ignore_user_abort(true) Say for user credit card transaction php executes even if user aborts or cron job. Here script ignore user abort and runs in the background.
- string nl2br (string str) Creates <br /> before all.
- string number_format (float num [, int decimals [, string decimal_point, string thousands_sep]]);
- QUERY_STRING + parse_str( ) => For obtaining queried parameter.
- printf(string with format specifier, placeholder1, placeholder2);
- void register_shutdown_function (function callback [, mixed param [, mixed …]]);
- sha1(): Secure Hash Algorithm. Its checksum is: 40-character hexadecimal string. Also, it is one-way encryption.
- string strip_tags (string html_text [, string allowed_tags]) To reduce cross-site scripting XSS.
- string wordwrap(string str [, int line_length [, string break_chara [, bool cut]]]);
Subscribe
Login
0 Comments