i would like to import an csv file and I have got a problem to compare the result with a constant.
my file is looking something like this:
1;1;23
1;2,11
...
When I dumped the first row I got this result:
array (size=3)
0 => string '1' (length=4)
1 => string '1' (length=1)
2 => string '23' (length=2)
How the hell could be the result string '1' = length 4
I also returned the length of the string with strlen and also trim the string but i got everytime the result 4. Btw I use the PHP version 7.4 with xampp
My Answer:
'1;1;23'_ 1 = '1;2'_ 2 = '11'_It seems like the string length of the second element in the array is higher than the actual string. This could be due to a formatting issue in the CSV file. Make sure that the delimiter used in the CSV file matches the one specified in your code. Additionally, check for any extra characters or spaces in the CSV file that might be causing the discrepancy in string length.
Rate this post
3 of 5 based on 5346 votesComments