Executes a command.
passthru() executes a command and sends the output directly back to the browser as binary data. This function should be used when the server generates binary data to be displayed in the browser, for example an image. The optional return_value holds the return value of the command.
<?php
Header("content-type:image/jpeg");
passthru("cat picture.jpg");
?> An image is displayed.This example shows how passthru() can be used to send binary data from a program to the browser. In this case, the UNIX program cat is used on an jpeg picture to send an image to the browser. A page with this code can be used in an img tag (<img src="passthru.php">), to show the image on a different page. To just show a picture like this, fpassthru() would be a more efficient alternative. However, cat could, for example, be replaced with another program that dynamically generates the picture.