enabling precise pattern matching and text manipulation Continuing on with our built-in functions with preg_match. To review the previous functions, read P101. https://blog.devgenius.io/php-p101-trim-htmlspecialchars-and-call-built-in-functions-7b4f25728db9 trim(), ltrim() , rtrim() htmlspecialchars() __call() preg_match() filter_var() addslashes() str_replace() strlen() strtolower() strtoupper() ucfirst() strpos(), stripos(), strrpos(), strripos() Array Functions like: array_chunk(), array_diff(), array_key_exists(), array_key_first(), array_key_last(), array_map(), array_merge(), array_push(), array_sum(), asort(), arsort(), count(), in_array(), ksort(), krsort(), sort(), rsort(), shuffle(), sizeof(), is_array(), explode(), implode() Magic Methods like: __invoke(), __toString() Regex Intro I have been debating whether to even cover this one since it requires knowledge of regular expressions. We want to be as thorough as possible, so we’ll need to include some
Month: October 2023
Using trim() for input sanitization, htmlspecialchars() for security, and __call() for dynamic method handling Through the last 100 PHP articles, we’ve used all sorts of built in functions. It’s time to collect them in one place, give a couple of examples, and add any additional ones that I might have missed. You may be asking what a built in function is. It’s just a function that comes with the PHP installation. You don’t have to know where they’re at. You don’t have to instantiate an object. They’re available globally. The functions that we’re going to look at are the following:
