Home > Blockchain >  A non well formed numeric value encountered during generate id
A non well formed numeric value encountered during generate id

Time:09-07

I am trying to generate unique number for my requirements like below

$click_id = intval(microtime()   floor(rand()));

Its working fine and giving me proper result like

1307460753

But I am getting warning called

A non well formed numeric value encountered in line 3.

I have tried remove intval but its still same. Let me know if anyone here can help me for solve the issue.

Thanks!

CodePudding user response:

microtime() return a string, pass true as the first parameter to enable as_float, so you can perform the math you'd like:

<?php

$click_id = intval(microtime(true)   floor(rand()));

echo $click_id;
  •  Tags:  
  • php
  • Related