note 112763 added to dir.constants
| From: | bimal at sanjaal dot com | Date: | Sat, 20 Jul 2013 19:22:08 +0000 |
| Subject: | note 112763 added to dir.constants | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-195689@lists.php.net to get a copy of this message | ||
I think, you can avoid using DIRECTORY_SEPARATOR to make your configurations. Let us look at a piece
of code from one of the nice tools I use. And compare the same work without this constant, below.
<?php
$class_dir = '..' . DIRECTORY_SEPARATOR . 'class';
require_once($class_dir . DIRECTORY_SEPARATOR . 'BCGColor.php');
require_once($class_dir . DIRECTORY_SEPARATOR . 'BCGBarcode.php');
require_once($class_dir . DIRECTORY_SEPARATOR . 'BCGDrawing.php');
require_once($class_dir . DIRECTORY_SEPARATOR . 'BCGFontFile.php');
?>
And I would have written it as:
<?php
$class_dir = '../class';
require_once($class_dir.'/BCGColor.php');
require_once($class_dir.'/BCGBarcode.php');
require_once($class_dir.'/BCGDrawing.php');
require_once($class_dir.'/BCGFontFile.php');
?>
Does not it look good when it runs nicely over Windows too? No problems with Linux flavors.
----
Server IP: 69.147.83.199
Probable Submitter: 110.34.0.242 (proxied: 182.93.93.8)
----
Manual Page -- http://php.net/manual/en/dir.constants.php
Edit -- https://master.php.net/note/edit/112763
Del: integrated -- https://master.php.net/note/delete/112763/integrated
Del: useless -- https://master.php.net/note/delete/112763/useless
Del: bad code -- https://master.php.net/note/delete/112763/bad+code
Del: spam -- https://master.php.net/note/delete/112763/spam
Del: non-english -- https://master.php.net/note/delete/112763/non-english
Del: in docs -- https://master.php.net/note/delete/112763/in+docs
Del: other reasons-- https://master.php.net/note/delete/112763
Reject -- https://master.php.net/note/reject/112763
Search -- https://master.php.net/manage/user-notes.php