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 Quote Link to comment 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); ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.