Tagged: php

php 0

Laravel .env variable always returns null

As per the Laravel document “Once the configuration has been cached, the .env file will not be loaded and all calls to the env function will return null.” You can find it here https://laravel.com/docs/5.5/configuration#configuration-caching...

php 0

Install new copy of Laravel

Install new copy of Laravel   Install Composer 1. Go to the Root command prompt and execute the below commands # sudo apt update # sudo apt install curl php-cli php-mbstring git unzip #...

php 0

How to remove the first character of string in PHP

The substr() function is the good solution: $NewString = substr($OldString, 1); Strings are indexed starting from 0, and substr() functions will start from second parameter to store new value into into variable. So the...

php 0

How to detect duplicate values in PHP array

In PHP one dimensional array to find the duplicate values use array_count_values($Array) For example, given the following array: $Array = array(‘Neha’, ‘Komal’, ‘Nidhi’, ‘Niti’, ‘Komal’, ‘Nidhi’, ‘Gaurav’, ‘Kittu’, ‘Komal’); I would like to print:...

php 0

How to get next and previous day in php

get next and previous day in php <?php $date = isset($_GET[‘date’]) ? $_GET[‘date’] : date(‘Y-m-d’); $prev_date = date(‘Y-m-d’, strtotime($date .’ -1 day’)); $next_date = date(‘Y-m-d’, strtotime($date .’ +1 day’)); ?> <a href=”?date=<?=$prev_date;?>”>Previous</a> <a href=”?date=<?=$next_date;?>”>Next</a>...