DEV Community

Cover image for numeric value encountered ErrorException (solution) in php Laravel
Osman Forhad
Osman Forhad

Posted on

numeric value encountered ErrorException (solution) in php Laravel

Recently I was working a Laravel project which was developed by our previous Software team. When I was assigned for this, project I was going to run this project at this time current version of php is php7. and I was run it by latest laragon server which php version is php7. But the previous team was working with php5. So, when I run the application it’s shows me an error like below:
Alt Text
Then I was trying to solve this error and search on the internet for that. After couple of time I got a clue for solving this. And a gentlemen gives a tip over the internet. The tips like below
Because you are passing a string as the second argument to the date function, which should be an integer.
string date (string $format [, int $timestamp = time ()])
Try strtotime which will Parse about any English textual datetime description into a Unix timestamp (integer):
date ("d", strtotime($_GET['start_date']));

but in my case our previous programmer writes a function which is like
date('Y-m',strtotime($t->date_of_birth1)
so, I was replace this function date(‘Y-m’,strtotime($t->date_of_birth1)) to date(‘d’,strtotime($t->date_of_birth1))
which idea I actually find from the internet gentlemen’s tips. Finally, my problem is solved. And php5 software run in my php7 updated platfrom.
Sorry to say I forgot this gentlemen’s name but I want to say thanks her.
.
that's it.
.
Happy Coding.
osman forhad
Mobile & Web Application Developer💻

Top comments (0)