php - file_put_contents adds "0" not string -


What would be the reason that file_put_contents will add 0 instead of string?

It adds a 0 file to each attempt. So on the third attempt 000.

$ masterpostEntry = $ heading "~" $ Filetitle; $ File = "../posts/master-allposts.txt"; $ Current = file_get_contents ($ file); $ Current = $ MasterpostEntry + "\ n"; File_put_contents ($ file, current $);

The resonant of $ masterpostEntry shows the correct result:

  CSS-only solution for UI tracking ~ css-only-solution-for-ui-tracking  

Although the content of master-allposts.txt is:

  000  

. concatenates, + is arithmetic:

  $ current. = $ MasterpostEntry + "\ n"; ^ ---  

You are adding "two strings", so PHP converts them into integers unless there is a few digits at the beginning of any of the strings in those stars. It will be equal to:

  $ current. = 0 + 0;  

Comments

Popular posts from this blog

winforms - C# Form - Property Change -

c# - NewtonSoft JArray - how to select multiple elements with LINQ -

javascript - amcharts makechart not working -