Curriculum
Course: PHP Basic
Login

Curriculum

PHP Basic

PHP Install

0/1

PHP Casting

0/1

PHP Constants

0/1

PHP Magic Constants

0/1

PHP Operators

0/1

PHP Reference

0/276
Text lesson

pclose()

Example

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);
?>

Definition and Usage

A pipe opened by popen() is closed using the pclose() function.

Syntax

pclose(pipe)

Parameter Values

 

Parameter

Description

pipe

Essential. identifies the pipe that popen() opened.

Technical Details

Return Value:

Upon failure, the termination state is -1.

PHP Version:

4.0+