1

I have this line of code in php

echo '<h1>' . fread($myfile,filesize("names.txt") . '</h1>');

when I try to run the code it says * Notice: A non well formed numeric value encountered * can anyody help? thanks.

INTODAN
  • 521
  • 1
  • 6
  • 14
  • Possible duplicate of [date() method, "A non well formed numeric value encountered" does not want to format a date passed in $\_POST](https://stackoverflow.com/questions/20574465/date-method-a-non-well-formed-numeric-value-encountered-does-not-want-to-fo) – Madhur Bhaiya Sep 11 '18 at 06:30
  • 3
    you have not closed `fread` properly – Jigar Shah Sep 11 '18 at 06:32

2 Answers2

1

There is a typo.

echo '<h1>' . fread($myfile,filesize("names.txt")) . '</h1>';

The fread included h1 after the filesize function.

Melvin Hagberg
  • 220
  • 2
  • 11
-2

It is probably because names.txt does not exist. Try to

var_dump(file_get_contents('names.txt')) 

in the line before to check that it indeed exists.

jacobdo
  • 1,605
  • 3
  • 15
  • 34