[PHP] register_shutdown_function() not working ?

2001-01-27 Thread Andrew Sitnikov

Hello php-general,

 Why this not working (php.4.0.4pl1_Linux)?
 
?
 error_reporting(E_ALL);

 $file_name = '../tmp/text.txt';

 function funct1(){
   global $file_name;
   if ($fd = fopen($file_name,'a+')){
 fwrite($fd,"Funct1\n");
 fclose($fd);
   }else{
 die("Can not open output file");
   }
 }

 function funct2(){
   global $file_name;
   if ($fd = fopen($file_name,'a+')){
 fwrite($fd,"Funct2\n");
 fclose($fd);
   }
 }

 $i = register_shutdown_function('funct2');
 funct1();
?

file have only  "Funct1" ?

Best regards,
 Andrew Sitnikov 
 e-mail : [EMAIL PROTECTED]
 GSM: (+372) 56491109



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] register_shutdown_function() not working ?

2001-01-27 Thread Andrew Sitnikov

Hello Andrew,

Sorry, but i forget what I have Zend Debuger :)

Problem in file path, when i use absolute path
/home/user/tmp/tmp/text.txt all works.

It appears, that in shutdown_function getcwd () == '/',
but in script getcwd () == '/home/user/public_html/'

Only not clearly why.


AS Hello php-general,

AS  Why this not working (php.4.0.4pl1_Linux)?
 
AS ?
AS  error_reporting(E_ALL);

AS  $file_name = '../tmp/text.txt';

AS  function funct1(){
ASglobal $file_name;
ASif ($fd = fopen($file_name,'a+')){
AS  fwrite($fd,"Funct1\n");
AS  fclose($fd);
AS}else{
AS  die("Can not open output file");
AS}
AS  }

AS  function funct2(){
ASglobal $file_name;
ASif ($fd = fopen($file_name,'a+')){
AS  fwrite($fd,"Funct2\n");
AS  fclose($fd);
AS}
AS  }

AS  $i = register_shutdown_function('funct2');
AS  funct1();
?

AS file have only  "Funct1" ?

AS Best regards,
AS  Andrew Sitnikov 
AS  e-mail : [EMAIL PROTECTED]
AS  GSM: (+372) 56491109






Best regards,
 Andrew Sitnikov 
 e-mail : [EMAIL PROTECTED]
 GSM: (+372) 56491109



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]