Home laravel How to fix the error 'A non well formed numeric value encountered'?

How to fix the error ‘A non well formed numeric value encountered’?

Author

Date

Category

I’m using version 5.2

When trying to display any of the variables ($ pages, $ portfolios, $ services, $ peoples, $ menu) via helper ‘dd’, “ErrorException in VarCloner.php line 298:
A non well formed numeric value encountered “

I suppose it has something to do with time. The fields ‘created_at’ and ‘updated_at’ are created with type ‘timestamp’, Null by default and filled with inserted dates.

Index.Controller

& lt;? php
namespace App \ Http \ Controllers;
use Illuminate \ Http \ Request;
use App \ Http \ Requests;
use App \ Page;
use App \ Service;
use App \ Portfolio;
use App \ People;
class IndexController extends Controller
{
  //
  public function execute (Request $ request) {
  $ pages = Page :: all ();
  $ portfolios = Portfolio :: get (array ('name', 'filter', 'images'));
  $ services = Service :: where ('id', '& lt;', 20) - & gt; get ();
  $ peoples = People :: take (3) - & gt; get ();
  $ menu = array ();
  foreach ($ pages as $ page) {
   $ item = array ('title' = & gt; $ page- & gt; name, 'alias' = & gt; $ page- & gt; alias);
   array_push ($ menu, $ item);
  }
  dd ($ menu);
  return view ('site.index');
 }
} 

Answer 1, authority 100%

Change php version or add explicit typecasting:

$ c = '';
$ d = 1 + (int) $ c; 

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions