Hosting Solutions
mobile_logo Table of Contents

Class File Creation Tutorial Learn PHP OOP

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; ?>

PHP Videos

Object Oriented Programming

Class File Creation Tutorial Learn PHP OOPClass Properties and Methods Object Oriented ProgrammingConvert MySQL Timestamp to Ago Time Format OOP TutorialUsing the property_exists FunctionUsing the method_exists FunctionUsing the get_parent_class functionUsing the get_object_vars FunctionUsing the get_declared_classes FunctionUsing the get_class FunctionUsing the get_class_vars FunctionUsing the get_class_methods FunctionUsing the class_exists FunctionPassword Strength Check Script Class OOP TutorialExtend Class Object Oriented Programming OOP