note 47620 added to function.chmod

From: Date: Tue, 23 Nov 2004 03:58:50 +0000
Subject: note 47620 added to function.chmod
Groups: php.notes 
Request: Send a blank email to php-notes+get-80902@lists.php.net to get a copy of this message
As noted by others below... 1) you cannot pass a string to chmod() as the mode, and 2) decimals work as well as octals for the mode. If you need to come up with the mode on the fly (maybe based on user input) and want to use something like: $mode = '0'.$owner.$group.$public; you can use your $mode (which is a string) with chmod like this: <?php // octal mode in a string i.e. '0755' $mode = '0'.$owner.$group.$public; $mode_dec = octdec($mode); // convert octal mode to decimal chmod($filename, $mode_dec); ?> ---- Manual Page -- http://www.php.net/manual/en/function.chmod.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+47620 Delete -- http://master.php.net/manage/user-notes.php?action=delete+47620&report=yes Reason: bad code -- http://master.php.net/manage/user-notes.php?action=delete+47620&report=yes&reason=bad+code Reason: spam -- http://master.php.net/manage/user-notes.php?action=delete+47620&report=yes&reason=spam Reason: useless example -- http://master.php.net/manage/user-notes.php?action=delete+47620&report=yes&reason=useless+example Reason: contains commercial links -- http://master.php.net/manage/user-notes.php?action=delete+47620&report=yes&reason=contains+commercial+links Reason: useless note -- http://master.php.net/manage/user-notes.php?action=delete+47620&report=yes&reason=useless+note Reject -- http://master.php.net/manage/user-notes.php?action=reject+47620&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#80902) next »