Bash
Read a File Line by Line in Bash (the Right Way)
while IFS= read -r line is the correct loop, but the last line, pipes, commands that read stdin and Windows line endings each have a trap. Here they are, tested.
Topic
while IFS= read -r line is the correct loop, but the last line, pipes, commands that read stdin and Windows line endings each have a trap. Here they are, tested.
A correct in_array() for Bash, an associative-array set for many lookups, and a demonstration of why [[ "${arr[*]}" =~ value ]] gives false positives.
PHP's explode() and implode() in Bash: read -ra and mapfile -d for splitting, "${arr[*]}" for joining, and functions that cope with multi-character delimiters.