eDemonOnline Website eDemon Online - The Ultimate Website .NET
Latest Release: No releases available yet eDemonOnline Project Summary Page at SourceForge.net Last Update: 9th February, 2008
  Back to eDemonOnline .net Homepage  
  A quick overview of eDemonOnline. Start here.  
  What's New in eDemonOnline .net development  
  Documentation of the development process of eDemonOnline  
  Development Style Guidelines for developers  
  Available releases for downloading. Redirects to sourceforge file release system.  
  The Release Notes documents of all releases  
  Programmers, Webmasters and Users guides to using eDemonOnline  
  Online reference of eDemonOnline .net Code for Programmers  
  eDemonOnline Mailing Lists Hosted by SourceForge.net  
  Discuss eDemonOnline issues on project's forums hosted by sourceforge.net  
  How to contribute to eDemonOnline if you like it  
  Sites of relevance to eDemonOnline  
     
  Support This Project  
     
  SourceForge.net Logo  

PHP .NET Core Library - Overview

The 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:

  1. IDictionary<TKey, TValue>
  2. IList<TArrayItem> (and sometimes TArrayItem[] if necessary)
  3. IEnumerable<TArrayItem> (and sometimes ICollection<TArrayItem>)
  4. IDictionary
  5. IList
  6. IEnumerable

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:

  • public enum CharacterCase { Upper, Lower };
  • public enum SearchCaseSensitivity { CaseSensitive, CaseInsensitive};
  • public enum SortOrder { Ascending, Descending};

Delegates:

  • public delegate void WalkArrayAction<TArrayItem>(TArrayItem item);
  • public delegate void WalkArrayActionComplete<TArrayItem>(int arrayItemIndex, TArrayItem item);
  • public delegate void WalkDictionaryAction<TKey, TValue>(TKey itemKey, TValue itemValue);
  • public delegate bool FilterArrayValuesCallback<TArrayItem>(TArrayItem item);
  • public delegate bool FilterArrayValuesCallbackAssoc<TKeys, TValues>(TKeys itemKey, TValues itemValue);
  • public delegate TReturn MapArrayValuesCallback<TArrayItem, TReturn>(TArrayItem item);
  • public delegate TReturn MapArrayValuesCallbackAssoc<TKeys, TValues, TReturn>(TKeys itemKey, TValues itemValue);

Classes:

  • public static class php{}
  • public static class array{}
  • public static class ctype{}

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