PHP Regex: preg_match, preg_replace and Capture Groups
Delimiters, character classes, anchors and capture groups โ the parts of PHP regex you actually use, and the one job you must never give it.
Browse all posts filed under Web Development.
๐ Web DevelopmentDelimiters, character classes, anchors and capture groups โ the parts of PHP regex you actually use, and the one job you must never give it.
๐ Web DevelopmentTwo functions carry almost every API you will write. json_encode, json_decode, the array-or-object rule, and why a silent null is not an empty result.
๐ Web Developmentsetcookie() writes a header, not a variable, which is why the cookie you just set is not in $_COOKIE until the browser sends it back on the next request.
๐ Web Developmentdate() to print it, strtotime() to read it, DateTime to do arithmetic on it โ and the timezone setting behind most off-by-five-hours bugs.
๐ Web DevelopmentOne variable, a list of values, and the missing break that catches everybody once. PHP switch explained, plus loose comparison and PHP 8's match.
๐ Web DevelopmentForms, sessions, a database and hashing finally come together. Registration, login, a page only members can reach, and a logout that clears all three of the things a session leaves behind.
๐ Web DevelopmentFour habits you build into ordinary code: never let user input become SQL, never let it become HTML, never store a password, and never assume a request came from your own page. Each problem shown breaking, then fixed.
๐ Web DevelopmentEvery site repeats its header and footer on every page. include and require are how you write that markup once and pull it in everywhere โ with the four keyword variants and the path mistake that only shows up in production.
๐ Web DevelopmentLearn PHP file upload the safe way: read $_FILES, verify the true type with finfo, limit the size, and rename before storing. A full beginner guide.