PCLZIP_CB_POST_ADD
This call back feature is called just after the add of each file in the archive. This call-back can not change the adding of the file, but can be usefullfor removing files or doing advanced work after the add.
The 'call-back' function, given as a value of the argument, must respect the following synopsis :
function myCallBack($p_event, &$p_header)
{
[... Your specific code ...]
return $result;
}When the method call the call-back function, it gives the following arguments :
- $p_event : the identity of the call-back argument (here PCLZIP_CB_POST_ADD). This is usefull when you want to use the same function for different call-back actions.
- $p_header : the description of the file that was added, specifically the name of the added file and the status of the add action. The array fields are described in the chapter 'Returned Values'.
The function can not modify the $p_header array because the add is alreay done.
The function must return 1 ($result). Other values are reserved for futur use.function myPostAddCallBack($p_event, &$p_header)
{
// ----- look for valid add
if ($p_header['status'] == 'ok') {
// ----- move the file to the trash can
rename($p_header['filename'], 'trash/'.$p_header['filename'])
}
}
$list = $archive->extract(PCLZIP_CB_POST_ADD, 'myPostAddCallBack');In this sample the call-back PCLZIP_CB_POST_ADD move the archived files in a 'trash' folder that can be destroyed later.
| [Optional Arguments List] |




