I have a script on my website that uses a flat txt file (it has no file extension) to print information. For instance:
file pizza1
pepperoni
cheese
peppers
and then I have a PHP file in a different directory (two directories up) that looks like this:
file pizzaviewer.php
<?PHP
$Lines = file("files/pizzas/pizza1");
list($toppingA, $toppingB, $toppingC) = explode("\n", $Lines);
echo 'Your pizza toppings are:';
echo '$toppingA';
echo '$toppingB';
echo '$toppingC';
?>
I want this script to return:
Your pizza toppings are L
pepperoni
cheese
peppers
But instead, the first variable (in this case, $toppingA) returns as "Array" and then the rest have no value (they're blank/empty). What am I doing wrong? I have had this problem before, and I suspect it has something to do with server config. This exact thing appears on www.php.net/explode and it works for them.