File Validation

Here is a simple function to valid a image file. You can modify/add extensions and mime type according to your needs. function checkImageTypeArray($file) { $errorarray=array(); $allowExtension = array(“gif”, “jpeg”, “jpg”, “png”); $allowMime = array(“image/gif”, “image/jpesg”, “image/pjpeg”, “image/x-png”,”image/png”); $getFileExtension = pathinfo($file[‘name’],PATHINFO_EXTENSION);…

String Search

1) strpos or stripos— strpos find the position of firstoccurance of string and returns false if string is not found. String position starts with 0 so dont compare with 0 for finding string $a = ‘How arEd you?’; if(strpos($a,’are’)!==false) {…

Page 1 of 212