16 - PHP Options/Info(1)
Core Extensions
PHP Extension

include Path

Get included Files

var_dump(get_included_files())
var_dump() -> 변수의 정보를 출력하는 함수
php.ini
ini_set('session.gc_maxlifetime', 1440);
ini_get('session.gc_maxlifetime');

Environment Variables


17 - PHP Options/Info (2)
Set assert options

18 - Error Handling
1) Log Level.
error_reporting(E_ALL & ~E_NOTICE);
2) Send Error Log
errorlog('Hello, world', 3, _DIR. '/logs/log.log');
3) Backtrace
4) Error Handling

callback을 받음
5) Trigger Custom Error

-Add

-Remove
Binary to Hex
$bytes = random_bytes(32);
// bin -> hex
bytes); -> ASCll 문자의 문자열을 16진수로 변환해준다
echo byes);
// hex -> bin
hex2bin($hex) -> 16진수를 ASCll 문자의 문자열로 변환해 줍니다.
One way hash (Encryption)
echo crypt('Hello, world','secret'); -> 문자열 암호화
$url = 'http://example.com';
var_dump(explode('//', $url));
HTML entities

Parse Query string -> 쿼리스트링 형식의 문자열을 변수로 해석하는 php 함수
'a=b&c=d';
$a = 'b';
$c = 'd';
Number_Format
echo number_format(123456789);
echo money_format('%1', 123456789);
$string

Print formatted string
-> %s String
-> %d Int
-> %f Float ex) "%.2f", 14.24);
printf("%", 'Hello, world');
$message = 'Hello, world';
printf("%s", $message);
printf("%s, %d", $message, 10);
Replace
Repeat str_repeat('*', 5);
Split -> 길이에 따른 분리
Word count 단어의 갯수를 세주는 함수
Compare ->strcmp('a','b')
a = b -> 0
a > b -> 1
a < b -> -1
Position -> 위치를 찾아주는 함수 strpos('Hello, world', 's)
First Position -> strpbrk('Hello, world', 'o');
strlen('Hello, world');
Reverse -> 문자열을 반전시키는 함수
strrev('Hello, world');
Sub String -> strstr('http://example.com', '//');
슬래시 뒤에 문자열
Token -> strtok
Slice -> substr('Hello, world', 7);
Compare -> substr_compare('Hello, world', 'world', -5);
Count -> substr_count('Hello, world', 'l', 0);
Wrapping -> wordwrap('Hello, world', 5, "\n", true);
21 - Hash
어떤 문자열이 고정된 뒤로

HMAC
Hash-based Message Authentication Code
key -> "secret"

22 - Password Hashing

23 - PCRE 정규 표현식


정규 표현식에서 사용할 수 있는 대표적인 특수 문자들
