![]() |
![]() |
|||
|
||||
|
PHP .NET Core Library - OverviewThe PHP .NET (PhpDotNet) Core Library is a class library that is part of the PHP .NET sub-project and that contains ports of the core PHP language function libraries. Within the library, most of the code is done using static classes that contains static methods that are near-clones of their PHP counterparts. We say near-clones not complete clones, because of the big difference between the PHP language which is not a full object oriented programming language and thus allows for constructs like functions and between the .NET framework languages (C# in specific) which does not. The .NET framework's CTS contains a good concrete sub-framework for collections available in the System.Collections, and System.Collections.Generic namespaces. While porting PHP functions into .NET methods, we tried to make maximum use of the collections framework in .NET yet at the same time, keep the use of the function the same as it is in PHP as much as possible. Sometimes a slight behavior change is necessary, but that is rare. Most of the time, the number of overloads for a certain method is what is most affected by the difference between the languages (PHP has only one array type which acts as both a dictionary-type collection and a list type collection. In the .NET CTS, there are several levels of collections starting from IEnumerable to Dictionary<TK, TV>). Because of these differences, we put in mind that any method should be able to correctly, most efficiently and type-safely do its job on the following types:
Because the string type in .NET is an IEnumerable, all collection methods can be applied to it as if it was a collection of characters. However, although this might be an advantage in most cases, in some cases it is a disadvantage (for example, the count_recursive method, which will treat a string as a collection so instead of counting the number of strings in a string array, it will count the number of total characters in all strings in the array). In such cases, a failsafe overload of the method is usually present. The method itself acts as if string is not a collection by default and the overload takes an extra bool argument "treatStringAsCollection" that, if set to true, will change the default behaviour and the method will treat strings as if they were collections of characters. The PHP .NET core class library currently declares the following classes grouped by their type: Enumerations:
Delegates:
Classes:
To see more information about a class, see the documentation for that class (usually named xx-class_name Reference) |
|||||||||||||||||||||||||||||||||||||||||||||||||||
Copyright © 2005 - eDemonOnline - The Ultimate Website .NET. For comments, contact webmaster |
||||||||||||||||||||||||||||||||||||||||||||||||||||