Category Archives: PHP

How to get table name by Model in Laravel 5?

Some times we requires get what’s the table name for particular Model. There is a function defined in Laravel itself name 1 getTable()getTable() Please look below example: 1 2 3 $transaction = new Transaction; $table = $transaction->getTable(); print_r($table); $transaction = new Transaction; $table = $transaction->getTable(); print_r($table);

How to Translate Text to desired language ?

Just follow these steps and copy & paste the code you can translate text easily. Step 1 : Make a div with id (id is compulsory) Like <div id="content">Loading…</div><div id="content">Loading…</div> Step 2 : Paste the following code to head section under script tag of your webpage.   <script type="text/javascript"> google.load("language", "1");   function initialize() {… Read More »

How to Remove Characters Except Numbers from a String ?

Following Code will remove all character,special characters including space.   $givenNumber = "1245fdfd8454D FDFDF434 3$#$#%";   $testingNumber = preg_replace('[D]’, ”, $givenNumber);   echo $testingNumber;   Output is : 124584544343 $givenNumber = "1245fdfd8454D FDFDF434 3$#$#%"; $testingNumber = preg_replace(‘[D]’, ”, $givenNumber); echo $testingNumber; Output is : 124584544343

How to Find Quarter Month From Any Year ?

A Quarter means 1/4 part of year. In the following example given Script is use to find which quarter of the year in the given date. Assuming given date is 10 December 2015 Following is the Example. Just Copy & Paste and Enjoy. $month = 12;   $date = 10;   $year = 2015;  … Read More »