Hướng dẫn php spl functions - các chức năng php spl

Mục lục

  • class_implements - Trả về các giao diện được thực hiện bởi lớp hoặc giao diện đã cho
  • class_parents - trả về các lớp cha của lớp đã cho
  • class_uses - Trả về các đặc điểm được sử dụng bởi lớp đã cho
  • iterator_apply - gọi hàm cho mọi phần tử trong trình lặp
  • iterator_count - Đếm các phần tử trong trình lặp
  • iterator_to_array - sao chép iterator vào một mảng
  • SPL_AUTOLOAD_CALL - Hãy thử tất cả các chức năng __autoload () đã đăng ký để tải lớp được yêu cầu
  • SPL_AUTOLOAD_EXTENSIONS - Đăng ký và trả về các phần mở rộng tệp mặc định cho SPL_Autoload
  • SPL_AUTOLOAD_FENSTIONS - Trả về tất cả các hàm __Autoload () đã đăng ký ()
  • SPL_AUTOLOAD_REGISTER - Đăng ký chức năng đã cho là __autoload () triển khai
  • SPL_AUTOLOAD_UNREGISTER
  • SPL_AUTOLOAD - Việc triển khai mặc định cho __autoload ()
  • SPL_CLASSES - Trả về các lớp SPL có sẵn
  • spl_object_hash - id băm trả về cho đối tượng đã cho
  • spl_object_id - Trả về tay cầm đối tượng số nguyên cho đối tượng đã cho

Villewittgmailcom ¶

16 năm trước

These to funtions has excatly the same output, the only diff. is in which directory iterator they use. I hope someone out there can use it:
function listfilesin1 ($dir = ".", $depth=0) {
    echo
"Dir: ".$dir."
"
;
    foreach(new
DirectoryIterator($dir) as $file) {
        if (!
$file->isDot()) {
            if (
$file->isDir()) {
               
$newdir = $file->getPathname();
               
listfilesin1($newdir, $depth+1);
            } else {
                echo
"($depth)".$file->getPathname() . "
"
;
            }
        }
    }
}
function
listfilesin2 ($dir = ".", $depth=0) {
    echo
"Dir: ".$dir."
"
;
    foreach(new
RecursiveDirectoryIterator($dir) as $file) {
        if (
$file->hasChildren(false)) {
           
$newdir = $file->key();
           
listfilesin2($newdir, $depth+1);
        } else {
            echo
"($depth)".$file->key() . "
"
;
        }
    }
}
listfilesin();
?>

đã tải67 tại hotmail dot com

14 năm trước

For some application I needed to reverse some standard iterators.

So I mocked up this flexible function.
Enjoy

function reverse_iterator(Iterator $iterator){
   
$type     = get_class($iterator);
   
$array     = array_reverse(iterator_to_array($iterator), true);
    return new
$type($array);
}
?>

semperluc (at) yahoo._forgot_the_rest ¶

15 năm trước

/*
How to store SPL Iterator results (rather than just echo-and-forget):

The library of Iterators  are object based, so you need to trick the little rascals into an array. 
Here's how (two ways) ...

1. Explicit typecasts: $a[] = (array)$Obj->objMethod();

2. Array definition: $a[] = array( key => $Obj->objMethod() );

Examples: DirectoryIterator()
*/

For some application I needed to reverse some standard iterators. 0

For some application I needed to reverse some standard iterators. 1

Benny tại Whallewashing Dot de ¶

14 năm trước

For some application I needed to reverse some standard iterators. 2

For some application I needed to reverse some standard iterators. 3

For some application I needed to reverse some standard iterators. 4

For some application I needed to reverse some standard iterators. 5

For some application I needed to reverse some standard iterators. 6

semperluc (at) yahoo._forgot_the_rest ¶

15 năm trước

For some application I needed to reverse some standard iterators. 7

For some application I needed to reverse some standard iterators. 8

For some application I needed to reverse some standard iterators. 9

Benny tại Whallewashing Dot de ¶

Helly tại php dot net ¶

So I mocked up this flexible function.
Enjoy
1

17 năm trước

16 năm trước

So I mocked up this flexible function.
Enjoy
2

So I mocked up this flexible function.
Enjoy
3

So I mocked up this flexible function.
Enjoy
4

So I mocked up this flexible function.
Enjoy
5

So I mocked up this flexible function.
Enjoy
6

So I mocked up this flexible function.
Enjoy
7

So I mocked up this flexible function.
Enjoy
8

So I mocked up this flexible function.
Enjoy
9

function reverse_iterator(Iterator $iterator){
   
$type     = get_class($iterator);
   
$array     = array_reverse(iterator_to_array($iterator), true);
    return new
$type($array);
}
?>
0

đã tải67 tại hotmail dot com

15 năm trước

function reverse_iterator(Iterator $iterator){
   
$type     = get_class($iterator);
   
$array     = array_reverse(iterator_to_array($iterator), true);
    return new
$type($array);
}
?>
2

function reverse_iterator(Iterator $iterator){
   
$type     = get_class($iterator);
   
$array     = array_reverse(iterator_to_array($iterator), true);
    return new
$type($array);
}
?>
3

function reverse_iterator(Iterator $iterator){
   
$type     = get_class($iterator);
   
$array     = array_reverse(iterator_to_array($iterator), true);
    return new
$type($array);
}
?>
4

function reverse_iterator(Iterator $iterator){
   
$type     = get_class($iterator);
   
$array     = array_reverse(iterator_to_array($iterator), true);
    return new
$type($array);
}
?>
5