I'm trying to display an image on screen by reading the contents and array and using that value to fill in part of the file name.
In the code below the array has 3 values, 100, 101 and 102. I'm trying to take the first value "100" to output
If I just set $image to the value of "100" it works fine. When I set $image as an array_slice, and echo $image, it returns "array" instead of "100".
<?php
$dirname = "images/wrf/";
$array=array("100", "101", "102");
$image = array_slice($array, 0, 1);
echo '<img src="' . $dirname . 'wrf' . $image . 'medium.jpg">';
//out put for debugging
print_r($array);
echo "contents of image===";
echo $image;
?>
array array_slice ( array $array , int $offset [, int $length = NULL [, bool $preserve_keys = false ]] )it clearly says that it returns an array.