Category:

What is REST Api?

Learn how we can create PHP Rest API. REST API means Representational state transfer is a software architectural style that defines a set of constraints to be used for creating Web services. In this article, you’ll learn everything you need to know about REST APIs to be able to read the API documentation and use them […]

Continue Reading
Posted On :
Category:

Create CSV file using PHP

Last updated on January 5th, 2020 at 07:01 pmn this post I will explain to you how we can create a CSV (comma-separated value) file using simple PHP code. CSV file is very useful when we need to import and export data from the server or transfer data to other servers or in excel format. […]

Continue Reading
Posted On :
Category:

Detect is your website is access from Mobile and Device

This is very simple and useful tip to detect that your user is using Android or iOs device to log in to your website in CakePHP 3 it is even easier CakePHP 3 device detection  $isMobile = $this->request->is(‘mobile’); $isAndroid = stripos($this->request->header(‘User-Agent’), ‘Android’); $isIPhone = stripos($this->request->header(‘User-Agent’), ‘iPhone’); $isIPad = stripos($this->request->header(‘User-Agent’), ‘iPad’); Core PHP $iPhone = stripos($_SERVER[‘HTTP_USER_AGENT’],”iPhone”); $iPad […]

Continue Reading
Posted On :
Category:

Round off decimal to nearest highest value

If you wan’t to round off decimal value to nearest heights value you can use bellow code <?php if( !function_exists(‘ceiling’) ) { function ceiling($number, $significance = 1) { $value = ( is_numeric($number) && is_numeric($significance) ) ? (ceil($number/$significance)*$significance) : false; if(!isFloatWith2Decimals($value)){ return $value.’0′; }else{ return $value; } } } function isFloatWith2Decimals($number) { return (bool) preg_match(‘/^(?:[1-9]{1}\d*|0)\.\d{2}$/’, $number); […]

Continue Reading
Posted On :