Adam Khoury

Donate funds to show love and support

Click the button below to donate funds securely online. You can use your PayPal account or a credit card.

Your donations help free up my time to produce more content and assist in covering server costs. It's also a great way to say thanks for the content!

Application Configuration

Adam will be adding options here soon.

Class File Creation Tutorial Learn PHP OOP

Published :
Author :
Adam Khoury
Learn Object Oriented Programming (OOP) in PHP. OOP is used to tap into class files that house your software logic in an organized, extensible, dynamic, reusable framework of sorts. You can use class files to create very robust custom frameworks in PHP. JavaScript and ActionScript 3.0 have similar flow to PHP so it also is easy to make external reusable modules for those languages as well. I also threw in a PHP bad word filter function, so you get a bit of string manipulation logic and array handling thrown in as bonus material. curseFilter.php (class file) <?php class curseFilter { function clean($str){ $curzwords = array("jerk","buttface","idiot"); $replacers = array("j**k","cuteface","id**t"); $cleanStr = str_ireplace($curzwords, $replacers, $str); return $cleanStr; } } ?> example.php (demo usage file) <?php include_once("curseFilter.php"); $curseFilter = new curseFilter; // ----------------------- $string = "you jerky idiot."; $clean_str = ($curseFilter -> clean($string)); echo $clean_str; ?>