Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

dir(3) [php man page]

DIR(3)									 1								    DIR(3)

dir - Return an instance of the Directory class

SYNOPSIS
Directory dir (string $directory, [resource $context]) DESCRIPTION
A pseudo-object oriented mechanism for reading a directory. The given $directory is opened. PARAMETERS
o $directory - Directory to open o $context - Note Context support was added with PHP 5.0.0. For a description of contexts, refer to "Streams". RETURN VALUES
Returns an instance of Directory, or NULL with wrong parameters, or FALSE in case of another error. EXAMPLES
Example #1 dir(3) example Please note the fashion in which Directory.read(3)'s return value is checked in the example below. We are explicitly testing whether the return value is identical to (equal to and of the same type as - see Comparison Operators for more information) FALSE since otherwise, any directory entry whose name evaluates to FALSE will stop the loop. <?php $d = dir("/etc/php5"); echo "Handle: " . $d->handle . " "; echo "Path: " . $d->path . " "; while (false !== ($entry = $d->read())) { echo $entry." "; } $d->close(); ?> The above example will output something similar to: Handle: Resource id #2 Path: /etc/php5 apache cgi cli NOTES
Note The order in which directory entries are returned by the read method is system-dependent. PHP Documentation Group DIR(3)

Check Out this Related Man Page

METHOD_EXISTS(3)							 1							  METHOD_EXISTS(3)

method_exists - Checks if the class method exists

SYNOPSIS
bool method_exists (mixed $object, string $method_name) DESCRIPTION
Checks if the class method exists in the given $object. PARAMETERS
o $object - An object instance or a class name o $method_name - The method name RETURN VALUES
Returns TRUE if the method given by $method_name has been defined for the given $object, FALSE otherwise. NOTES
Note Using this function will use any registered autoloaders if the class is not already known. EXAMPLES
Example #1 method_exists(3) example <?php $directory = new Directory('.'); var_dump(method_exists($directory,'read')); ?> The above example will output: bool(true) Example #2 Static method_exists(3) example <?php var_dump(method_exists('Directory','read')); ?> The above example will output: bool(true) SEE ALSO
function_exists(3), is_callable(3), class_exists(3). PHP Documentation Group METHOD_EXISTS(3)
Man Page

14 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Path autocompletion in ksh

Say, I want to move into dir library from current dir, on prompt if I type in cd li if it is followed by pressing 'Tab' key then complete dir name appears. Would there anyone know, how we can make into effect this path autocompletion? I am using 'ksh'. (5 Replies)
Discussion started by: videsh77
5 Replies

2. Shell Programming and Scripting

to find the file with full path

Hi, I have written this shell script: fl=`ls -1lrt $mylist | grep '\.xml$' | awk '{print $9}'` echo $fl (1) for i in $fl do for dir in $mylist do if then echo $dir/$i >> tmp (2) fi done done The mylist contains some directory names. The satement (1) gives the sorted list... (5 Replies)
Discussion started by: surjyap
5 Replies

3. UNIX for Dummies Questions & Answers

Link to a directory

Hi Experts, Is there any way to link the contents (subdirectories/files) of a existing directory A to another existent directory B.. The relative path of /root/Directory A/ Directory A |__ Subdirectory A1 |__File A |__File B |__ Subdirectory A2 |__File A ... (6 Replies)
Discussion started by: ganga.dharan
6 Replies

4. Shell Programming and Scripting

Creating Directory

Hi All, As I m very new for Unix, I need to check for a directory and move a file. If Directory is not found, The script should create a directory and move the file. Can any one help here. (7 Replies)
Discussion started by: vikramtk
7 Replies

5. Shell Programming and Scripting

need Script logic

Hi, i have a file called sc.txt cat sc.txt ecf0183.sh ecf1002.sh ecf1011.sh ecf1020.sh another file callled All.csv Type,S Name,Mem Lib,S Id,S Table,App,Group Reg sch,ecf1002,Link from 1,pcor1,EER,ecf1002.sh,ECF-D-LND-AMZ-A Reg sch,ecf1002a,Link from... (7 Replies)
Discussion started by: JSKOBS
7 Replies

6. UNIX for Dummies Questions & Answers

Some one look into this

$ export ABC1=/my/dir $ export t=2 $ echo $ABC1 /my/dir $ echo $ABC$t 2 $ echo $ABC${t} 2 I tried different ways but couldnet get expected result... can some one let me know where am wrong and what would i need to type to get correct output by giving variable t (7 Replies)
Discussion started by: maddyfreaks
7 Replies

7. Shell Programming and Scripting

Find file only from a Directory

Hi, I am using the below query to find files from a Directory: SOURCE_DIR--Directory Files in the Directory: ABC.log XYZ.out The SOURCE_DIR has subdirectory.... when i use the below command... find /apps/informatica/node1/scripts/test '(' -name '*.log' -o -name '*.out'... (12 Replies)
Discussion started by: ch33ry
12 Replies

8. Shell Programming and Scripting

Moving files from one directory to another based on 2 date variables

Hi All, I am currently coding for a requirement(LINUX OS) where I am supposed to move a file (Lets Call it Employee.txt) from Directory A to Directory B based on 2 date fields as below, Date_Current = 20120620 Date_Previous = 20120610 Source Directory : /iis_data/source Target... (11 Replies)
Discussion started by: dsfreddie
11 Replies

9. UNIX for Dummies Questions & Answers

Cannot Delete Directory

Hello, I am trying to delete a directory but cannot. Can anyone assist? See attached. Many thanks. (6 Replies)
Discussion started by: dixer
6 Replies

10. Shell Programming and Scripting

need simple echo question

Hi I want to use echo command as below echo 'dir=' $1 ' dir|file|home' i need output like below : echo 'dir=' $1 ' dir|file|home' pp13dff Output dir=pp13dff dir|file|home (4 Replies)
Discussion started by: asavaliya
4 Replies

11. Solaris

Solaris,PHP,Expect support

Hello All, I installed php5 from OpenCSW but i believe it does not support the expect module. I tried to run a php script to call expect to do a telnet to a device but i got this error PHP Warning: fopen(): Unable to find the wrapper "expect" - did you forget to enable it when you... (6 Replies)
Discussion started by: kaf3773
6 Replies

12. What is on Your Mind?

Directory vs. Folder?

How would you call it? (24 Replies)
Discussion started by: absorber
24 Replies

13. UNIX for Advanced & Expert Users

Formatted Directory Listing Question

Greetings to you. I have a quick question for the community today ;) I'm interested in the following format for recursive output from a command such as "ls" or "dir" when pointed to a folder: ...but there doesn't seem to be coverage for this type of output formatting in the manpages. Maybe... (11 Replies)
Discussion started by: LinQ
11 Replies

14. Shell Programming and Scripting

Find Command Include Sub Directory

This script writes the output files to FILES but I don't want to exclude all directories from ABC_CHQ and LYS_ADV, I want to include one sub directory name process which is under ABC_CHQ and LYS_ADV in the search. Right now its excluding everything from prune directories such as ABC_CHQ, LYS_ADV... (10 Replies)
Discussion started by: John William
10 Replies