monkeypaw201 Posted August 12, 2008 Share Posted August 12, 2008 Is there a way to convert array to string? I'm not sure thats what I need, but something isn't working.. what step did i overlook? <?php #Link files into variables $vatsim_file = file($vatsim); $metacraft_file = file($metacraft); $fsproshop_file = file($fsproshop); #Get the last UPDATE variable $vatsim_time = substr($vatsim_file,2543,14); $metacraft_time = substr($metacraft_file,2543,14); $fsproshop_time = substr($fsproshop_file,2543,14); ?> Outputs: Notice: Array to string conversion in /incoming.php on line 23 Notice: Array to string conversion in /incoming.php on line 24 Notice: Array to string conversion in /incoming.php on line 25 Link to comment https://forums.phpfreaks.com/topic/119354-solved-array-to-string/ Share on other sites More sharing options...
Psycho Posted August 12, 2008 Share Posted August 12, 2008 Well, file() reads a file as an array and substr() expects a string object. Not sure what you are trying to accomplish, but you could use implode() to convert the file contents into a string or, probably better, use file_get_contents() to read the file as a string to begin with. <?php #Link files into variables $vatsim_file = file_get_contents($vatsim); $metacraft_file = file_get_contents($metacraft); $fsproshop_file = file_get_contents($fsproshop); #Get the last UPDATE variable $vatsim_time = substr($vatsim_file,2543,14); $metacraft_time = substr($metacraft_file,2543,14); $fsproshop_time = substr($fsproshop_file,2543,14); ?> Link to comment https://forums.phpfreaks.com/topic/119354-solved-array-to-string/#findComment-614819 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.