PHP check if string contains something
Checking if a string contains a substring is very frequently occuring use case in PHP code. PHP functions strpos or stripos (case insensitive version) can read more
PHP – split string examples
Splitting a string/text at a delimiter is very common use case in php. One can either use php explode (split on a fixed delimiter) or read more
PHP – take last n characters of a string
Take last 3 characters when string is big enough Take last 3 characters when string is smaller than 3 chars
PHP – convert dos newline to unix format
Files or strings in DOS format may have \r (carriage return) along with \n (newline). This may appear as ^M in some editors. Here is read more