In this article, you will learn how to close an opened pipe in PHP. The pclose() function in PHP closes a pipe. The pipe in PHP is open by the open() function.
what is the syntax of the PCLOSE function in php?
pclose(pipe)
Parameter | Description |
---|---|
pipe | Required. Specifies the pipe opened by popen() |
examples of the PCLOSE function
Example 1. In this example, we open and close a pipe to the program specified in the command parameter.
<?php
$file = popen("/bin/ls","r");
//some code to be executed
pclose($file);
?>