<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>ext/Makefile</filename>
    </added>
    <added>
      <filename>ext/extconf.rb</filename>
    </added>
    <added>
      <filename>ext/ionize_php_ext.c</filename>
    </added>
    <added>
      <filename>ext/ionize_php_ext.o</filename>
    </added>
    <added>
      <filename>ext/ionize_php_ext.so</filename>
    </added>
    <added>
      <filename>lib/ionize/environment/includes.rb</filename>
    </added>
    <added>
      <filename>lib/ionize/environment/to_bool.rb</filename>
    </added>
    <added>
      <filename>lib/ionize/tool.rb</filename>
    </added>
    <added>
      <filename>lib/ionize/treetop/ext.rb</filename>
    </added>
    <added>
      <filename>spec/fixtures/call_user_func_array.php</filename>
    </added>
    <added>
      <filename>spec/fixtures/split.php</filename>
    </added>
    <added>
      <filename>spec/fixtures/uasort.php</filename>
    </added>
    <added>
      <filename>spec/fixtures/usort.php</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -12,4 +12,6 @@ website/db/production.sqlite3
 
 *~
 
-website/access.log
\ No newline at end of file
+website/access.log
+
+etc/*
\ No newline at end of file</diff>
      <filename>.gitignore</filename>
    </modified>
    <modified>
      <diff>@@ -12,13 +12,9 @@ a compatibility library to execute the converted code.
 Check out http://ionize.farleyknight.com for a live demo
 of the library, so you can see what works and what doesn't.
 
-== SYNOPSIS:
-
-?? (What's this?)
-
 == REQUIREMENTS:
 
-Treetop, ParseTree, and Ruby2Ruby to translate
+Treetop, ParseTree, and Ruby2Ruby (1.1.9) to translate
 
 Rack to run the Php compat environment
 </diff>
      <filename>README.rdoc</filename>
    </modified>
    <modified>
      <diff>@@ -4,75 +4,13 @@ require 'logger'
 module Ionize
   def self.root_dir
     require 'pathname'
-    Pathname.new(File.dirname(File.dirname(__FILE__))).realpath.to_s
+    File.dirname(File.dirname(Pathname.new(__FILE__).realpath.to_s))
   end
 end
 
 require &quot;#{Ionize.root_dir}/lib/ionize&quot;
-
-module Ionize
-  module Php
-    class Convert
-      def initialize
-        if File.exists? &quot;debug.log&quot;
-          FileUtils.rm &quot;debug.log&quot;
-        end
-        @logger = Logger.new(&quot;debug.log&quot;)
-      end
-
-      def run
-        @logger.debug &quot;Got #{ARGV.inspect} as arguments&quot;
-        ARGV.each do |file_name|
-          if File.exists? file_name
-            convert_file(file_name)
-          elsif File.directory? file_name
-            @logger.debug &quot;#{file_name} was a directory. Converting..&quot;
-            convert_directory(file_name)
-            files.each do |file|
-              convert_file(file)
-            end
-          else
-            # Should actually print the usage here..
-            @logger.debug &quot;Couldn't determine what to do with #{file_name}, not a php file or directory&quot;
-          end
-        end
-      end
-
-      def convert_file(php_file, ruby_file = nil)
-        @logger.debug &quot;Converting #{php_file}&quot;
-        ruby_file ||= php_file + &quot;.rb&quot;
-
-        ruby_dir = File.dirname(ruby_file)
-        FileUtils.mkdir_p(ruby_dir) unless File.exists?(ruby_dir)
-
-        begin
-          File.open(ruby_file, &quot;w+&quot;) do |f|
-            f.write(Ionize::Php.to_ruby(File.read(php_file)))
-          end
-        rescue =&gt; error
-          FileUtils.rm ruby_file
-          @logger.debug &quot;Couldn't convert #{php_file}&quot;
-          @logger.debug &quot;Error: #{error.inspect}&quot;
-          error.backtrace.each_with_index do |line, i|
-            @logger.debug &quot;#{i}: #{line}&quot;
-          end
-        end
-        @logger.debug &quot;Converted file #{php_file} and stored it as #{ruby_file}&quot;
-      end
-
-      def convert_directory(php_directory, ruby_directory = nil)
-        ruby_directory ||= &quot;#{php_directory}-ruby&quot;
-        FileUtils.mkdir ruby_directory unless File.exists?(ruby_directory) and File.stat(ruby_directory).directory?
-        Dir[&quot;#{php_directory}/**/*&quot;].select {|f| f =~ /\.php$/ }.each do |php_file|
-          ruby_file = php_file.gsub(php_directory, ruby_directory).gsub(&quot;.php&quot;, &quot;.rb&quot;)
-          @logger.debug &quot;Found file #{php_file}&quot;
-          convert_file(php_file, ruby_file)
-        end
-      end
-    end
-  end
-end
+require &quot;#{Ionize.root_dir}/lib/ionize/tool&quot;
 
 if __FILE__ == $0
-  Ionize::Php::Convert.new.run
+  Ionize::Php::Tool.new(ARGV.first, ARGV.rest)
 end</diff>
      <filename>bin/ionize</filename>
    </modified>
    <modified>
      <diff>@@ -79,9 +79,9 @@ extout =
 extout_prefix = 
 target_prefix = 
 LOCAL_LIBS = 
-LIBS =   -ldl -lcrypt -lm   -lc
-SRCS = binding_new.c
-OBJS = binding_new.o
+LIBS =   -ldl -lcrypt -lm   -lc -L/usr/local/lib/ -lphp5
+SRCS = php_interp.c
+OBJS = php_interp.o
 TARGET = php_interp
 DLLIB = $(TARGET).so
 EXTSTATIC = </diff>
      <filename>etc/php_interp/Makefile</filename>
    </modified>
    <modified>
      <diff>@@ -13,6 +13,7 @@ $INCFLAGS &lt;&lt; &quot; -I/usr/include/php5/main/&quot;
 $INCFLAGS &lt;&lt; &quot; -I/usr/include/php5/Zend/&quot;
 $INCFLAGS &lt;&lt; &quot; -I/usr/include/php5/TSRM/&quot;
 
+$LIBS &lt;&lt; &quot; -L/usr/local/lib/ -lphp5&quot;
 
 # Do the work
 create_makefile(extension_name)</diff>
      <filename>etc/php_interp/extconf.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,5 +1,9 @@
 
+/***************************************************
+   Includes
+***************************************************/
 
+#include &lt;stdio.h&gt;
 #include &lt;php_config.h&gt;
 #include &lt;zend_config.h&gt;
 
@@ -11,13 +15,296 @@
 #include &lt;php.h&gt;
 #include &lt;php_ini.h&gt;
 #include &lt;php_main.h&gt;
-
+#include &lt;sapi/embed/php_embed.h&gt;
 #include &lt;SAPI.h&gt;
-#include &lt;TSRM.h&gt;
 
+#include &lt;TSRM.h&gt;
 #include &quot;ruby.h&quot;
 
-static VALUE global_stuff()
+
+/***************************************************
+   Typedefs
+***************************************************/
+
+typedef struct {
+  void *ctx;
+  int ref;
+  VALUE *output_handler;
+} PhpInterp;
+
+ZEND_BEGIN_MODULE_GLOBALS(php_interp)
+//    struct perlistats ps_stats;
+    PhpInterp *php;
+ZEND_END_MODULE_GLOBALS(php_interp)
+
+ZEND_DECLARE_MODULE_GLOBALS(php_interp);
+
+/***************************************************
+   Defines
+***************************************************/
+
+#define INTERP_CTX_ENTER(ctx)
+#define INTERP_CTX_LEAVE()
+
+#define PhpInterpG(v) (php_interp_globals.v)
+
+
+PHP_FUNCTION(php_interp_test)
+{
+  RETURN_STRING(&quot;It works!!&quot;, 1); 
+} 
+
+
+/***************************************************
+   Globals
+***************************************************/
+
+static VALUE rb_cPhpInterp;
+
+static int ze_started = 0;
+static PhpInterp *one_true_interp = NULL;
+
+static function_entry php_interp_functions[] = {
+  PHP_FE(php_interp_test, NULL)
+  {NULL, NULL, NULL}
+};
+
+zend_module_entry php_interp_module_entry = {
+  STANDARD_MODULE_HEADER,
+  &quot;php_interp&quot;,
+  php_interp_functions,
+  NULL, //  PHP_MINIT(php_interp),
+  NULL,
+  NULL,
+  NULL,
+  NULL, //  PHP_MINFO(php_interp),
+  NULL,
+  STANDARD_MODULE_PROPERTIES
+};
+
+static sapi_module_struct php_interp_sapi = {
+  &quot;php_interp&quot;,
+  &quot;Ionize::Php::Interpreter&quot;,
+  NULL, /* startup */
+  zend_shutdown, /* shutdown */
+  NULL, /* activate */
+  NULL, /* deactivate */
+  NULL, //  sandwich_sapi_ub_write,
+  NULL, /* flush */
+  NULL, /* get uid */
+  NULL, /* getenv */
+  zend_error,
+  NULL, //  sandwich_sapi_header_handler,
+  NULL, // sandwich_sapi_send_headers,
+  NULL, /* send header */
+  NULL, /* read POST */
+  NULL, // sandwich_sapi_read_cookies,
+  NULL, // sandwich_sapi_reg_server_vars,
+  NULL, // sandwich_sapi_log_message,
+  STANDARD_SAPI_MODULE_PROPERTIES
+};
+
+
+PhpInterp *php_interp_setup();
+
+
+int php_interpreter_create()
+{
+  zend_compiler_globals *compiler_globals;
+  zend_executor_globals *executor_globals;
+  php_core_globals *core_globals;
+  sapi_globals_struct *sapi_globals;
+  void ***tsrm_ls;
+
+  if(ze_started) {
+    return 0;
+  }
+
+  sapi_startup(&amp;php_interp_sapi);
+  ze_started = 1;
+  if (FAILURE == php_module_startup(&amp;php_interp_sapi, &amp;php_interp_module_entry, 1)) {
+    fprintf(stderr, &quot;Failed to initialize PHP\n&quot;);
+    return -1;
+  }
+
+  return 0;
+}
+
+
+
+static void php_interp_mark() { }
+static void php_interp_free() { }
+
+PhpInterp *php_interp_setup() 
+{
+  PhpInterp *info;
+
+  if(one_true_interp) 
+    return one_true_interp;
+
+  printf(&quot;Allocating space for intepreter\n&quot;);
+  info = calloc(sizeof(*info), 1);
+  info-&gt;ref = 1;
+
+  one_true_interp = info;
+
+  printf(&quot;Beginning context for intepreter\n&quot;);
+  info-&gt;ref = 1;
+  printf(&quot;INTERP_CTX_ENTER intepreter\n&quot;);
+  INTERP_CTX_ENTER(info-&gt;ctx);
+  {
+    printf(&quot;Starting TSRMLS_FETCH();\n&quot;);
+    TSRMLS_FETCH();
+    
+    printf(&quot;Calling ini entries for intepreter\n&quot;);
+    //    zend_alter_ini_entry(&quot;register_argc_argv&quot;, 19, &quot;0&quot;, 1, PHP_INI_SYSTEM, PHP_INI_STAGE_ACTIVATE);
+    //    zend_alter_ini_entry(&quot;html_errors&quot;, 12, &quot;0&quot;, 1, PHP_INI_SYSTEM, PHP_INI_STAGE_ACTIVATE);
+    //    zend_alter_ini_entry(&quot;implicit_flush&quot;, 15, &quot;1&quot;, 1, PHP_INI_SYSTEM, PHP_INI_STAGE_ACTIVATE);
+    //    zend_alter_ini_entry(&quot;max_execution_time&quot;, 19, &quot;0&quot;, 1, PHP_INI_SYSTEM, PHP_INI_STAGE_ACTIVATE);
+
+    printf(&quot;Setting up global variables for intepreter\n&quot;);
+    SG(headers_sent) = 1;
+    SG(request_info).no_headers = 1;
+    SG(server_context) = info;
+    SG(options) = SAPI_OPTION_NO_CHDIR;
+    //    php_request_startup(TSRMLS_C);
+    PG(during_request_startup) = 0;
+    PhpInterpG(php) = info;
+    INTERP_CTX_LEAVE();
+  }
+
+  return info;
+}
+
+
+static VALUE php_interp_alloc(VALUE klass)
+{
+  if (php_interpreter_create() == -1) {
+    // We should raise an error here.. 
+    // &quot;Error creating Zend Runtime\n&quot;
+    return Qnil;
+  }
+
+  PhpInterp *interp;
+  printf(&quot;Creating intepreter\n&quot;);
+  interp = php_interp_setup();
+  
+  printf(&quot;Returning intepreter\n&quot;);
+  return Data_Wrap_Struct (klass, php_interp_mark, php_interp_free, interp);
+}
+
+int php_interp_eval_for_real_this_time(char *str, zval *retval_ptr, char *string_name TSRMLS_DC)
 {
-  return INT2FIX(0);
+  printf(&quot;Code is:\n&quot;);
+  //  rb_warn(str);
+
+  zval pv;
+  zend_op_array *new_op_array;
+  zend_op_array *original_active_op_array = EG(active_op_array);
+  zend_function_state *original_function_state_ptr = EG(function_state_ptr);
+  zend_uchar original_handle_op_arrays;
+  int retval;
+
+  printf(&quot;Checking for return value pointer\n&quot;);
+  if (retval_ptr) {
+    pv.value.str.len = strlen(str) + sizeof(&quot; return true;&quot;) -1;
+    pv.value.str.val = emalloc(pv.value.str.len + 1);
+    strcpy(pv.value.str.val, str);
+    strcat(pv.value.str.val, &quot; return true;&quot;);
+  }
+
+  pv.type = IS_STRING;
+
+  printf(&quot;Swapping original op array with a temp 0 value\n&quot;);
+  original_handle_op_arrays = CG(handle_op_arrays);
+  CG(handle_op_arrays) = 0;
+
+  printf(&quot;Compiling the string to an array\n&quot;);
+  new_op_array = compile_string(&amp;pv, string_name TSRMLS_CC);
+
+  printf(&quot;Swapping op array back to original\n&quot;);
+  CG(handle_op_arrays) = original_handle_op_arrays;
+
+  printf(&quot;Managing the op arrays\n&quot;);
+  if (new_op_array) {
+    printf(&quot;Setting local retval..\n&quot;);
+
+    zval *local_retval_ptr=NULL;
+    zval **original_return_value_ptr_ptr = EG(return_value_ptr_ptr);
+    zend_op **original_opline_ptr = EG(opline_ptr);
+
+    printf(&quot;Executing the op array..\n&quot;);
+    EG(return_value_ptr_ptr) = &amp;local_retval_ptr;
+    EG(active_op_array) = new_op_array;
+    EG(no_extensions)=1;
+    zend_execute(new_op_array TSRMLS_CC);
+
+    printf(&quot;Branches related to local_retval..\n&quot;);
+    if (local_retval_ptr) {
+      if (retval_ptr) {
+        COPY_PZVAL_TO_ZVAL(*retval_ptr, local_retval_ptr);
+      } else {
+        zval_ptr_dtor(&amp;local_retval_ptr);
+      }
+    } else {
+      if (retval_ptr) {
+        INIT_ZVAL(*retval_ptr);
+      }
+    }
+
+    printf(&quot;Cleaning up..\n&quot;);
+    
+    EG(no_extensions)=0;
+    EG(opline_ptr) = original_opline_ptr;
+    EG(active_op_array) = original_active_op_array;
+    EG(function_state_ptr) = original_function_state_ptr;
+    destroy_op_array(new_op_array TSRMLS_CC);
+    efree(new_op_array);
+    EG(return_value_ptr_ptr) = original_return_value_ptr_ptr;
+    retval = SUCCESS;
+  } else {
+    retval = FAILURE;
+  }
+
+  printf(&quot;Setting return value and finishing\n&quot;);
+  zval_dtor(&amp;pv);
+  return retval;  
+}
+
+
+VALUE php_interp_real_eval(PhpInterp *interp, char *code) 
+{
+  char *argv[1] = {NULL};
+
+  printf(&quot;Embed init\n&quot;);
+  php_embed_init(0, argv PTSRMLS_CC); 
+
+  printf(&quot;First try\n&quot;);
+  zend_first_try {
+    printf(&quot;Before eval string\n&quot;);
+    zend_eval_string(&quot;echo 'Hello World';&quot;, NULL, &quot;Embedded Code&quot; TSRMLS_CC);
+    printf(&quot;After eval string\n&quot;);
+  } zend_catch { 
+    /* int exit_status = EG(exit_status); */ 
+  } zend_end_try(); 
+  php_embed_shutdown(TSRMLS_C);
+
+
+  return Qnil;
+}
+
+static VALUE php_interp_eval(VALUE self, VALUE code) 
+{
+
+  PhpInterp *interp; 
+  Data_Get_Struct(self, PhpInterp, interp); 
+
+  VALUE new_str = rb_str_dup(code);
+  return php_interp_real_eval(interp, StringValuePtr(new_str)); 
+}
+
+void Init_php_interp() {
+  rb_cPhpInterp = rb_define_class(&quot;PhpInterp&quot;, rb_cObject);
+  rb_define_alloc_func(rb_cPhpInterp, php_interp_alloc);
+  rb_define_method(rb_cPhpInterp, &quot;eval&quot;, php_interp_eval, 1);
 }</diff>
      <filename>etc/php_interp/php_interp.c</filename>
    </modified>
    <modified>
      <diff></diff>
      <filename>etc/php_interp/php_interp.so</filename>
    </modified>
    <modified>
      <diff>@@ -2,18 +2,20 @@ $:.unshift(File.dirname(__FILE__)) unless
   $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
 
 require 'rubygems'
-
 require 'rack'
 
-gem &quot;ruby2ruby&quot;, &quot;1.1.9&quot;
+gem &quot;ParseTree&quot;, &quot;2.2.0&quot;
 require 'parse_tree'
 
+gem &quot;ruby2ruby&quot;, &quot;1.1.9&quot;
+require 'ruby2ruby'
+
 require 'ionize/ext'
 require 'ionize/translate'
 require 'ionize/environment'
 
-require 'ionize/dhaka'
 require 'ionize/treetop'
+require 'ionize/php_to_ruby'
 
 module Ionize
   def self.root_dir
@@ -23,38 +25,37 @@ module Ionize
 
   module Php
     CharacterLimit = 50000
-    def self.to_tokens(string)
-      const_get(parser).to_tokens(string)
-    end
-    
-    def self.to_ast(string)
-      const_get(parser).to_ast(string)
-    end
-    
-    def self.to_sexp(string)
-      const_get(parser).to_sexp(string)
-    end
-
-    def self.to_raw_sexp(string)
-      const_get(parser).to_raw_sexp(string)
-    end
-
-    def self.to_ruby(string)
-      const_get(parser).to_ruby(string)
-    end
-
-    # The parser we will use to parse Php
-    # Set to Dhaka by default
-    def self.parser
-#      @@parser ||= :Dhaka
-      @@parser ||= :Treetop
-    end
-
-    # Specify the parser. Either :Dhaka or :Treetop
-    def self.parser=(other)
-      raise &quot;Parser can only be :Dhaka or :Treetop!&quot; unless [:Dhaka, :Treetop].include? other
-      require other.to_s.downcase
-      @@parser = other
+    class &lt;&lt; self
+      def to_tokens(string)
+        const_get(parser).to_tokens(string)
+      end
+      
+      def to_ast(string)
+        const_get(parser).to_ast(string)
+      end
+      
+      def to_sexp(string)
+        const_get(parser).to_sexp(string)
+      end
+
+      def to_raw_sexp(string)
+        const_get(parser).to_raw_sexp(string)
+      end
+
+      def to_ruby(string)
+        const_get(parser).to_ruby(string)
+      end
+
+      def parser
+        @@parser ||= :Treetop
+      end
+
+      # Specify the parser. Either :Dhaka or :Treetop
+      def parser=(other)
+        raise &quot;Parser can only be :Dhaka or :Treetop!&quot; unless [:Dhaka, :Treetop].include? other
+        require other.to_s.downcase
+        @@parser = other
+      end
     end
   end
 end</diff>
      <filename>lib/ionize.rb</filename>
    </modified>
    <modified>
      <diff>@@ -20,7 +20,11 @@ module Ionize
     
     def ruby_from(ast)
       ast = php_ast(ast) if ast.is_a? String
-      Ruby2Ruby.new.process(ast)
+      Php::Php2Ruby.new.process(ast)
+    end
+    
+    def php_to_ruby_eval(text)
+      eval(Ionize::Php.to_ruby(text))
     end
   end
 end</diff>
      <filename>lib/ionize/console.rb</filename>
    </modified>
    <modified>
      <diff>@@ -2,61 +2,49 @@
 load File.dirname(__FILE__) + '/environment/php_array.rb'
 load File.dirname(__FILE__) + '/environment/application.rb'
 load File.dirname(__FILE__) + '/environment/reference.rb'
+load File.dirname(__FILE__) + '/environment/includes.rb'
 
 module Ionize
   module Php
-    Config = {
-      &quot;magic_quotes_gpc&quot;     =&gt; true,
-      &quot;magic_quotes_runtime&quot; =&gt; true
-    }
+    class Response
+      def self.current
+        @response ||= build_response
+      end
+
+      def self.build_response
+        self.new
+      end
+
+      attr_accessor :header
+
+      def header
+        @header ||= {}
+      end
+    end
+
+    class Config
+      def self.hash
+        @hash ||= defaults
+      end
+
+      def self.defaults
+        {
+          &quot;magic_quotes_gpc&quot;     =&gt; true,
+          &quot;magic_quotes_runtime&quot; =&gt; true
+        }
+      end
+
+      def self.[](other)
+        hash[other]
+      end
+    end
+
     module Environment
-      def self.included(target)
-        Kernel.module_eval do
-          def array(*args)
-            PhpArray.from_mixed(*args)
-          end
-          
-          def get_magic_quotes_gpc
-            Php::Config[&quot;magic_quotes_gpc&quot;] ? 1 : 0
-          end
-          
-          def get_magic_quotes_runtime
-            Php::Config[&quot;magic_quotes_runtime&quot;] ? 1 : 0
-          end
-
-          def gethostbyaddr(string)
-            address = string.split(&quot;.&quot;).map {|n| n.to_i }.pack(&quot;CCCC&quot;)
-            Socket.gethostbyaddr(address).first
-          end
-
-          def reference(&amp;block)
-            # Taken from:
-            # http://onestepback.org/index.cgi/Tech/Ruby/RubyBindings.rdoc/style/print
-            Reference.new(block.call, block.binding)
-          end
-          alias :ref :reference
-        end
-        
-        String.class_eval do
-          def preg_match(regex)
-            matches = match(regex)
-            return [!matches.nil?, matches.to_a]
-          end
-          
-          def preg_match_all(regex)
-            copy = self.dup
-            results = []
-
-            match = copy.match(regex)
-            while match
-              results &lt;&lt; match.to_a
-              copy.gsub!(match.to_a.first, &quot;&quot;)
-              match = copy.match(regex)
-            end
-
-            [results.length - 1, results.transpose]
-          end
+      def self.included(base)
+        Includes.constants.each do |const|
+          base.send :include, Includes.const_get(const)
         end
+        require 'lib/ionize/environment/to_bool'
       end
     end
   end</diff>
      <filename>lib/ionize/environment.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,67 +1,108 @@
 
+require 'rbtree'
+
 module Ionize
   module Php
     module Environment
-      class PhpArray &lt; Hash
-        def initialize(*args, &amp;block)
+      class PhpArray
+        def initialize(hash = nil)
           @index = 0
-          super(*args, &amp;block)
+          @hash = hash || RBTree.new
+          sort!
+        end
+
+        def internal_hash
+          @hash
         end
+        alias :ihash :internal_hash
 
-        def join(*args)
-          values.join(*args)
+        def [](key)
+          @hash[key]
         end
 
-        def hash?
-          keys.any? {|k| k.class != Fixnum } 
+        def []=(key, value)
+          if key.is_a? Fixnum and key &gt;= @index
+            @index = key + 1
+          end
+          @hash[key] = value
         end
+        alias :put :[]=
 
-        def array?
-          keys.all? {|k| k.class == Fixnum }
+        def &lt;&lt;(value)
+          put(@index, value)
         end
+        alias :add :&lt;&lt;
 
         def combine(second)
-          array = self.class.new
-          second.values.each_with_index do |val, key| 
-            array.put(self[key], val)
-          end
-          array
+          
+        end
+
+        def shift
+          tmp, return_value = @hash.shift
+          @hash = RBTree[*@hash.map do |key, value|
+                           if key.is_a? Numeric
+                             [key-1, value]
+                           else
+                             [key, value]
+                           end
+                         end.flatten]
+          return_value
         end
 
         def intersect(second)
           array = self.class.new
-          second.values.each do |value|
-            if self.values.include? value
-              key = self.to_a.select {|k,v| v == value }.first.first
-              array.put(key, value)
+
+          @hash.each do |key, value|
+            if second.ihash.any? {|k, v| v == value }
+              array[key] = value
             end
           end
+          
           array
         end
 
-        def add(value)
-          put(@index, value)
+        def numeric_keys?
+          @hash.keys.all? {|k| k.is_a? Numeric }
         end
 
-        def put(key, value)
-          if key.is_a? Fixnum and key &gt;= @index
-            @index = key+1
+        def sort!
+          @hash.readjust do |f, s| 
+            if f.class == s.class
+              f &lt;=&gt; s 
+            else
+              1
+            end
           end
-          self[key] = value
         end
 
-        def to_hash
-          Hash[*(self.to_a).flatten]
+        def count
+          @hash.size
         end
 
-        def merge(other)
-          if self.array? and other.array?
-            self.class.from_array(*(self.values + other.values))
-          else
-            self.class.from_hash(super(other))
+        def each(&amp;block)
+          if block.arity == 1
+            @hash.values.each(&amp;block)
+          elsif block.arity == 2
+            @hash.each(&amp;block)
           end
         end
 
+        def sort_by_function(name)
+          @hash.readjust {|f, s| send(name, f, s) }
+        end
+
+        def to_a
+          @hash.values
+        end
+
+        def empty?
+          @hash.empty?
+        end
+
+        def merge(other)
+          
+        end
+
         def self.from_mixed(*args)
           array = self.new
           args.each do |arg|
@@ -71,23 +112,47 @@ module Ionize
               array.add(arg)
             end
           end
+          array.sort!
           array
         end
 
         def self.from_hash(hash)
           array = self.new
           hash.each {|key, value| array.put(key, value)}
+          array.sort!
           array
         end
         
         def self.from_array(*args)
           array = self.new
           args.each {|arg| array.add(arg)}
+          array.sort!
           array
         end
 
         def inspect
-          &quot;array(&quot; + super.gsub(&quot;{&quot;, &quot;&quot;).gsub(&quot;}&quot;, &quot;&quot;) + &quot;)&quot;
+          &quot;array(&quot; + hash_inspect + &quot;)&quot;
+        end
+
+        def hash_inspect
+          # @hash.to_hash.inspect.gsub(&quot;{&quot;, &quot;&quot;).gsub(&quot;}&quot;, &quot;&quot;)
+          @hash.to_a.map {|k, v| &quot;#{k}=&gt;#{v}&quot; }.join(&quot;, &quot;)
+        end
+
+        def ==(other)
+          if other.is_a? PhpArray
+            @hash.to_hash == other.ihash.to_hash
+          else
+            false
+          end
+        end
+
+        def to_bool
+          if self.empty?
+            true
+          else
+            false
+          end
         end
       end
     end</diff>
      <filename>lib/ionize/environment/php_array.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,78 +1,78 @@
 
- class Array
-   {:second =&gt; 1, :third =&gt; 2, :fourth =&gt; 3, :fifth =&gt; 4, :sixth =&gt; 5}.each do |name, value|
-     define_method(name) { self[value] }
-   end
+class Array
+  {:second =&gt; 1, :third =&gt; 2, :fourth =&gt; 3, :fifth =&gt; 4, :sixth =&gt; 5}.each do |name, value|
+    define_method(name) { self[value] }
+  end
 
-   def rest
-     self[1..-1]
-   end
+  def rest
+    self[1..-1]
+  end
 
-   def replace_pattern(pattern, value)
-     copy = self.dup
-     (0..copy.length).each do |i|
-       if copy[i] == pattern
-         copy[i] = value
-       elsif copy[i].is_a? Array
-         copy[i] = copy[i].replace_pattern(pattern, value)
-       end 
-     end   
-     copy
-   end  
+  def replace_pattern(pattern, value)
+    copy = self.dup
+    (0..copy.length).each do |i|
+      if copy[i] == pattern
+        copy[i] = value
+      elsif copy[i].is_a? Array
+        copy[i] = copy[i].replace_pattern(pattern, value)
+      end 
+    end   
+    copy
+  end  
 
-   def composite_node?
-     first.is_a? Array
-   end
+  def composite_node?
+    first.is_a? Array
+  end
 
-   def unbox
-     if composite_node? and length == 1
-       first.unbox
-     else
-       self
-     end
-   end
+  def unbox
+    if composite_node? and length == 1
+      first.unbox
+    else
+      self
+    end
+  end
 
-   def to_block
-     if composite_node?
-       if length &gt; 1
-         [:block] + self
-       else
-         first
-       end
-     else
-       self
-     end
-   end
+  def to_block
+    if composite_node?
+      if length &gt; 1
+        [:block] + self
+      else
+        first
+      end
+    else
+      self
+    end
+  end
 
-   def to_block!
-     result = to_block
-     if result.first != :block
-       if result.composite_node?
-         [:block] + result
-       else
-         [:block, result]
-       end
-     else
-       result
-     end
-   end
+  def to_block!
+    result = to_block
+    if result.first != :block
+      if result.composite_node?
+        [:block] + result
+      else
+        [:block, result]
+      end
+    else
+      result
+    end
+  end
 
-   def tail
-     if last.is_a? Array
-       last.tail
-     else
-       self
-     end
-   end
+  def tail
+    if last.is_a? Array
+      last.tail
+    else
+      self
+    end
+  end
 
-   def tail=(other)
-     if last.is_a? Array
-       last.tail = other
-     else
-       self.replace(other)
-     end
-   end
- end
+  def tail=(other)
+    if last.is_a? Array
+      last.tail = other
+    else
+      self.replace(other)
+    end
+  end
+end
 
 class Symbol
   def to_global_id</diff>
      <filename>lib/ionize/ext.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,30 +1,6 @@
 
 require 'ruby2ruby'
 
-# Some kind of weird hack in ParseTree causing masgn to screw up..
-# This is a fix..
-UnifiedRuby.module_eval do
-  def rewrite_masgn(exp)
-    t, lhs, lhs_splat, rhs = exp
-
-    lhs ||= s(:array)
-
-    if lhs_splat then
-      case lhs_splat.first
-      when :array then
-        lhs_splat = lhs_splat.last if lhs_splat.last.first == :splat
-      when :splat then
-        # do nothing
-      else
-        lhs_splat = s(:splat, lhs_splat)
-      end
-      lhs &lt;&lt; lhs_splat
-    end
-
-    s(t, lhs, rhs).compact
-  end
-end
-
 module Ionize
   module Php
     class Php2Ruby &lt; Ruby2Ruby
@@ -75,7 +51,6 @@ module Ionize
         exp.shift
       end
 
-
       def process_masgn(exp)
         lhs = exp.shift
         rhs = exp.empty? ? nil : exp.shift</diff>
      <filename>lib/ionize/php_to_ruby.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,66 +1,71 @@
 require 'treetop'
-load 'ionize/treetop/pre_parser.rb'
+require 'ionize/treetop/pre_parser'
+require 'ionize/treetop/ext'
 
 module Ionize
   module Php
     module Treetop
       class ParseError &lt; RuntimeError; end
+      class ValidationError &lt; RuntimeError; end
 
-      def self.load!
-        ::Treetop.load &quot;#{Ionize.root_dir}/lib/ionize/treetop/php&quot;
-      end
+      class &lt;&lt; self
+        def load!
+          ::Treetop.load &quot;#{Ionize.root_dir}/lib/ionize/treetop/php&quot;
+        end
 
-      def self.to_tokens(string, opts = {})
-        load!
-        parser = PhpParser.new
-        result = parser.parse(PreParser.new(string).run)
-        if result
-          result
-        else
-          raise ParseError.new(parser.failure_reason)
+        def to_tokens(string, opts = {})
+          load!
+          parser = PhpParser.new
+          result = parser.parse(PreParser.new(string).run)
+          if result
+            result
+          else
+            raise ParseError.new(parser.failure_reason)
+          end
         end
-      end
 
-      def self.to_sexp(string, opts = {})
-        $globals = []
-        if opts[:validate] == false
-          sexpify(to_tokens(string, opts))
-        else
-          valid?(sexpify(to_tokens(string)))
+        def to_sexp(string, opts = {})
+          $globals = []
+          if opts[:validate] == false
+            sexpify(to_tokens(string, opts))
+          else
+            valid?(sexpify(to_tokens(string)))
+          end
         end
-      end
+        alias :to_ast :to_sexp
 
-      def self.to_ruby(string)
-        Php::Dhaka::Translate::Php2Ruby.new.process(to_sexp(string))
-      end
+        def to_ruby(string)
+          Php2Ruby.new.process(to_sexp(string))
+        end
 
-      def self.sexpify(ast)
-        if ast.respond_to? :to_ast and (not ast.nil?)
-          ast.to_ast
-        elsif ast.respond_to? :elements
-          sexpify(ast.elements)
-        elsif ast.is_a? Array
-          result = ast.map {|e| sexpify(e) }.reject {|e| e == nil or e == [] }
-          if result.length == 1 and result.first.is_a? Array
-            result.first
+        def sexpify(ast)
+          if ast.respond_to? :to_ast and (not ast.nil?)
+            ast.to_ast
+          elsif ast.respond_to? :elements
+            sexpify(ast.elements)
+          elsif ast.is_a? Array
+            result = ast.map {|e| sexpify(e) }.reject {|e| e == nil or e == [] }
+            if result.length == 1 and result.first.is_a? Array
+              result.first
+            else
+              result
+            end
+          elsif ast.nil?
+            nil
           else
-            result
+            raise &quot;Can't handle ast #{ast.inspect}!&quot;
           end
-        elsif ast.nil?
-          nil
-        else
-          raise &quot;Can't handle ast #{ast.inspect}!&quot;
         end
-      end
 
-      def self.valid?(ast, parent = nil)
-        if ast.is_a? Array
-          if ast.empty?
-            raise &quot;Caught empty node with parent #{parent.inspect}&quot;
-          elsif ast.composite_node?
-            raise &quot;Caught composite node #{ast.inspect} with parent #{parent.inspect}&quot;
-          else
-            ast.each {|node| valid? node, ast }
+        def valid?(ast, parent = nil)
+          if ast.is_a? Array
+            if ast.empty?
+              raise ValidationError.new(&quot;Caught empty node with parent #{parent.inspect}&quot;)
+            elsif ast.composite_node?
+              raise ValidationError.new(&quot;Caught composite node #{ast.inspect} with parent #{parent.inspect}&quot;)
+            else
+              ast.each {|node| valid? node, ast }
+            end
           end
         end
       end
@@ -69,76 +74,3 @@ module Ionize
 end
 
 
-Treetop::Runtime::SyntaxNode.class_eval do
-  def method_missing(method, *args, &amp;block)
-    error = &quot;Couldn't find #{method} on SyntaxNode with text_value #{text_value.inspect} and extension modules #{extension_modules.inspect}&quot; 
-    raise NoMethodError, error
-  end
-
-  def sexpify(ast)
-#    puts &quot;sexpifying #{ast.inspect}&quot;
-    if ast.nil?
-      nil
-    elsif ast.is_a? Array
-      sexpify_array(ast)
-    elsif ast.astable? and not ast.null?
-      [ast.to_ast].unbox
-    elsif ast.elements?
-      sexpify(ast.elements)
-    elsif ast.blank? or ast.space?
-      nil
-    else
-      raise &quot;Cannot sexpify #{ast.text_value}!&quot;
-    end
-  end
-  
-  def sexpify_array(ast)
-    ast.map do |e| 
-      sexpify(e) 
-    end.reject do |e| 
-      e == nil or e == [] or e == [nil]
-    end.map do |e|
-      e.unbox
-    end.unbox    
-  end
-
-  def to_sym
-    text_value.to_sym
-  end
-  
-  def unbox
-    elements.first
-  end
-
-  def size
-    elements.size
-  end
-
-  def has?(element)
-    respond_to? element and not send(element).blank?
-  end
-
-  def blank?
-    text_value == &quot;&quot;
-  end
-
-  def space?
-    text_value =~ /\s*/
-  end
-
-  def astable?
-    respond_to? :to_ast
-  end
-
-  def null?
-    false
-  end
-
-  def elements?
-    respond_to? :elements
-  end
-  
-  def textable?
-    respond_to? :text_value
-  end
-end</diff>
      <filename>lib/ionize/treetop.rb</filename>
    </modified>
    <modified>
      <diff>@@ -14,4 +14,8 @@ module SpecHelperMethods
   def php_to_ruby_eval(text)
     eval(Ionize::Php.to_ruby(text))
   end
+
+  def php_to_ruby_eval_file(file)
+    eval(Ionize::Php.to_ruby(File.read(file)))
+  end
 end</diff>
      <filename>spec/helper.rb</filename>
    </modified>
    <modified>
      <diff>@@ -3,76 +3,264 @@ require 'spec'
 require 'spec/helper'
 require 'lib/ionize'
 
-describe &quot;Transforms Php for posix regex&quot; do
+describe &quot;Compatible with Posix regex functions&quot; do
   include Ionize::Php::Environment, SpecHelperMethods
 
   it &quot;rewrites ereg&quot; do
-    php_ast(%Q{ $date = &quot;2008-08-09&quot;; $result = ereg(&quot;([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})&quot;, $date, $matches); }).should ==
-      ruby_ast(%Q{ date = &quot;2008-08-09&quot;; result, matches = date.match(/([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})/) })
+    pending do
+      php_ast(%Q{ $date = &quot;2008-08-09&quot;; $result = ereg(&quot;([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})&quot;, $date, $matches); }).should ==
+        ruby_ast(%Q{ date = &quot;2008-08-09&quot;; result, matches = date.match(/([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})/) })
+    end
   end
-
+  
   it &quot;rewrites eregi&quot; do
-    php_ast(%Q{ $date = &quot;2008-08-09&quot;; $result = eregi(&quot;([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})&quot;, $date, $matches); }).should ==
-      ruby_ast(%Q{ date = &quot;2008-08-09&quot;; result, matches = date.match(/([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})/i) })
+    pending do
+      php_ast(%Q{ $date = &quot;2008-08-09&quot;; $result = eregi(&quot;([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})&quot;, $date, $matches); }).should ==
+        ruby_ast(%Q{ date = &quot;2008-08-09&quot;; result, matches = date.match(/([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})/i) })
+    end
   end  
 end
 
-describe &quot;Transforms Php for miscellaneous functions&quot; do
+describe &quot;Compatible with FunctionHandling functions&quot; do
+  # http://us2.php.net/manual/en/ref.funchand.php
   include Ionize::Php::Environment, SpecHelperMethods
 
-  it &quot;rewites var_dump&quot; do
-    php_ast(%Q{ a = &quot;something&quot;; var_dump($a); }).should ==
-      ruby_ast(%Q{ a = &quot;something&quot;; puts a })
+  it &quot;supports function_exists&quot; do
+    php_to_ruby_eval(%q{ function_exists('array'); }).should == true
+    php_to_ruby_eval(%q{ function_exists('doesnt_exist'); }).should == false
   end
 
-  it &quot;rewrites isset&quot; do
-    php_ast(%Q{ $a = &quot;something&quot;; isset($a); }).should ==
-      ruby_ast(%Q{ a = &quot;something&quot;; a.not_nil? })
-  end
-
-  it &quot;rewrites function_exists&quot; do
-    php_ast(%Q{ function_exists('file_get_contents'); }).should ==
-      ruby_ast(%Q{ respond_to? 'file_get_contents' })
+  it &quot;supports call_user_func_array&quot; do
+    php_to_ruby_eval_file(&quot;spec/fixtures/call_user_func_array.php&quot;).should == 3
   end
 end
 
-describe &quot;Transforms Php for miscellaneous functions&quot; do
+describe &quot;Compatible with NetworkHandling functions&quot; do
   include Ionize::Php::Environment, SpecHelperMethods
 
   it &quot;evaluates gethostbyaddr to the domain name&quot; do
     php_to_ruby_eval(%Q{ gethostbyaddr(&quot;127.0.0.1&quot;); }).should == &quot;localhost&quot;
     php_to_ruby_eval(%Q{ gethostbyaddr(&quot;75.127.96.35&quot;); }).should == &quot;li22-35.members.linode.com&quot;
   end
+
+  it &quot;supports header&quot; do
+    header('Location: http://www.example.com/')
+    Ionize::Php::Response.current.header.should == {&quot;Location&quot; =&gt; &quot;http://www.example.com/&quot;}
+    
+    header('Content-type: application/pdf')
+    Ionize::Php::Response.current.header.should == {&quot;Location&quot; =&gt; &quot;http://www.example.com/&quot;, &quot;Content-type&quot; =&gt; &quot;application/pdf&quot;}
+
+    header('Content-Disposition: attachment; filename=&quot;downloaded.pdf&quot;')
+    Ionize::Php::Response.current.header.should == {&quot;Location&quot; =&gt; &quot;http://www.example.com/&quot;, &quot;Content-type&quot; =&gt; &quot;application/pdf&quot;, &quot;Content-Disposition&quot; =&gt; 'attachment; filename=&quot;downloaded.pdf&quot;'}
+
+    pending do 
+      header(&quot;HTTP/1.0 404 Not Found&quot;)
+      Ionize::Php::Response.current.code.should == 404
+    end
+  end
+end
+
+describe &quot;Compatible with PCRE functions&quot; do
+  include Ionize::Php::Environment, SpecHelperMethods
+
+  it &quot;supports preg_match_all&quot; do
+    pending do 
+      raise &quot;TODO&quot;
+    end
+  end
+
+  it &quot;supports preg_split&quot; do
+    preg_split(&quot;/[\s,]+/&quot;, &quot;hypertext language, programming&quot;).should == array(0=&gt;hypertext, 1=&gt;language, 2=&gt;programming)
+  end
+
+  it &quot;supports preg_replace&quot; do
+    string = 'April 15, 2003'
+    pattern = '/(\w+) (\d+), (\d+)/i'
+    replacement = '${1}1,$3'
+    preg_replace(pattern, replacement, string).should == &quot;April1,2003&quot;
+
+    string = 'The quick brown fox jumped over the lazy dog.'
+
+    patterns = array()
+    patterns[0] = '/quick/'
+    patterns[1] = '/brown/'
+    patterns[2] = '/fox/'
+    
+    replacements = array()
+    replacements[2] = 'bear'
+    replacements[1] = 'black'
+    replacements[0] = 'slow'
+
+    preg_replace(patterns, replacements, string).should == &quot;The bear black slow jumped over the lazy dog.&quot;
+
+    ksort(patterns)
+    ksort(replacements)
+    preg_replace(patterns, replacements, string).should == &quot;The slow black bear jumped over the lazy dog.&quot;
+  end
+
+  it &quot;supports preg_replace with several regexes&quot; do
+    patterns = array('/(19|20)(\d{2})-(\d{1,2})-(\d{1,2})/', '/^\s*{(\w+)}\s*=/')
+    replace = array('\3/\4/\1\2', '$\1 =')
+    preg_replace(patterns, replace, '{startDate} = 1999-5-27').should == &quot;$startDate = 5/27/1999&quot;
+  end
+
+  it &quot;supports preg_replace&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+
+  it &quot;supports preg_match&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+
+  it &quot;supports preg_replace_callback&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+
+  it &quot;supports preg_split&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+
+  it &quot;supports preg_match_all&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+
+  it &quot;supports preg_quote&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+
+  it &quot;supports preg_grep&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
 end
 
 
-describe &quot;Transforms Php for arrays&quot; do
+describe &quot;Compatible with PhpArray functions&quot; do
   include Ionize::Php::Environment, SpecHelperMethods
+
+  it &quot;supports array_intersect&quot; do
+    php_to_ruby_eval(%q{ $array1 = array(&quot;a&quot; =&gt; &quot;green&quot;, &quot;red&quot;, &quot;blue&quot;); $array2 = array(&quot;b&quot; =&gt; &quot;green&quot;, &quot;yellow&quot;, &quot;red&quot;); array_intersect($array1, $array2); }).should == array(0=&gt;&quot;red&quot;, &quot;a&quot;=&gt;&quot;green&quot;)
+  end 
+
+  it &quot;supports array_shift&quot; do
+    stack = array(&quot;orange&quot;, &quot;banana&quot;, &quot;apple&quot;, &quot;raspberry&quot;)
+    fruit = array_shift(stack) 
+    fruit.should == &quot;orange&quot;
+    stack.should == array(0=&gt;&quot;banana&quot;, 1=&gt;&quot;apple&quot;, 2=&gt;&quot;raspberry&quot;)
+  end
+
+  it &quot;supports array_pop&quot; do
+    stack = array(&quot;orange&quot;, &quot;banana&quot;, &quot;apple&quot;, &quot;raspberry&quot;)
+    fruit = array_pop(stack)
+    fruit.should == &quot;raspberry&quot;
+    stack.should == array(&quot;orange&quot;, &quot;banana&quot;, &quot;apple&quot;)
+  end
   
+  it &quot;supports array_merge&quot; do
+    array1 = array({&quot;color&quot; =&gt; &quot;red&quot;}, 2, 4)
+    array2 = array(&quot;a&quot;, &quot;b&quot;, {&quot;color&quot; =&gt; &quot;green&quot;, &quot;shape&quot; =&gt; &quot;trapezoid&quot;}, 4)
+    result = array_merge(array1, array2)
+    result.should == array(0 =&gt; 2, 1 =&gt; 4, 2 =&gt; 'a', 3 =&gt; 'b', 4 =&gt; 4, 'shape' =&gt; 'trapezoid', 'color' =&gt; 'green')
+
+    array1 = array()
+    array2 = array(1 =&gt; &quot;data&quot;)
+    result = array_merge(array1, array2)
+    result.should == array(0 =&gt; &quot;data&quot;)    
+  end
+
+  it &quot;supports array_keys&quot; do
+    array1 = array(0 =&gt; 100, &quot;color&quot; =&gt; &quot;red&quot;)
+    array_keys(array1).should == array(0 =&gt; 0, 1 =&gt; 'color')
+    
+    array2 = array(&quot;blue&quot;, &quot;red&quot;, &quot;green&quot;, &quot;blue&quot;, &quot;blue&quot;)
+    array_keys(array2, &quot;blue&quot;).should == array(0 =&gt; 0, 1 =&gt; 3, 2 =&gt; 4)
+    
+    array3 = array(&quot;color&quot; =&gt; array(&quot;blue&quot;, &quot;red&quot;, &quot;green&quot;), &quot;size&quot; =&gt; array(&quot;small&quot;, &quot;medium&quot;, &quot;large&quot;))
+    array_keys(array3).should == array(0 =&gt; 'color', 1 =&gt; 'size')
+  end
+
+  it &quot;supports + on arrays&quot; do
+    array1 = array()
+    array2 = array(1 =&gt; &quot;data&quot;)
+    result = array1 + array2
+    result.should == array(1 =&gt; &quot;data&quot;)
+  end
+
+  it &quot;inserts pairs in the order received&quot; do
+    php_to_ruby_eval(%Q{ array(&quot;d&quot;=&gt;&quot;lemon&quot;, &quot;a&quot;=&gt;&quot;orange&quot;, &quot;b&quot;=&gt;&quot;banana&quot;, &quot;c&quot;=&gt;&quot;apple&quot;) }).pairs.should ==
+      [[&quot;d&quot;, &quot;lemon&quot;], [&quot;a&quot;, &quot;orange&quot;], [&quot;b&quot;, &quot;banana&quot;], [&quot;c&quot;, &quot;apple&quot;]]
+
+    array1 = array()
+    array1[2] = &quot;foo&quot;
+    array1[0] = &quot;bar&quot;
+    array1[1] = &quot;baz&quot;
 
-  it &quot;rewrites array_intersect&quot; do
-    php_ast(%Q{ 
-      $array1 = array(&quot;a&quot; =&gt; &quot;green&quot;, &quot;red&quot;, &quot;blue&quot;);
-      $array2 = array(&quot;b&quot; =&gt; &quot;green&quot;, &quot;yellow&quot;, &quot;red&quot;);
-      $result = array_intersect($array1, $array2);
-}).should == ruby_ast(%Q{
-      array1  = array({&quot;a&quot; =&gt; &quot;green&quot;}, &quot;red&quot;, &quot;blue&quot;)
-      array2 = array({&quot;b&quot; =&gt; &quot;green&quot;}, &quot;yellow&quot;, &quot;red&quot;)
-      result = array1.intersect(array2)
-})
+    array1.pairs.should == [[2, &quot;foo&quot;], [0, &quot;bar&quot;], [1, &quot;baz&quot;]]
   end
 
-  it &quot;finds common hash values from the first array in the rest of the arrays&quot; do
-    php_to_ruby_eval(%Q{ 
-      $array1 = array(&quot;a&quot; =&gt; &quot;green&quot;, &quot;red&quot;, &quot;blue&quot;);
-      $array2 = array(&quot;b&quot; =&gt; &quot;green&quot;, &quot;yellow&quot;, &quot;red&quot;);
-      $result = array_intersect($array1, $array2);
-      $result;
-}).should == array(&quot;a&quot; =&gt; &quot;green&quot;, 0 =&gt; &quot;red&quot;)
+  it &quot;supports ksort&quot; do
+    fruits = array(&quot;d&quot;=&gt;&quot;lemon&quot;, &quot;a&quot;=&gt;&quot;orange&quot;, &quot;b&quot;=&gt;&quot;banana&quot;, &quot;c&quot;=&gt;&quot;apple&quot;)
+
+    ksort(fruits)
+    fruits.pairs.first.should == [[&quot;a&quot;, &quot;orange&quot;], [&quot;b&quot;, &quot;banana&quot;], [&quot;c&quot;, &quot;apple&quot;], [&quot;d&quot;, &quot;lemon&quot;]]
+  end
+
+  it &quot;supports array_filter with a callback&quot; do
+    def even(var)
+      var &amp; 1
+    end
+
+    def odd(var)
+      !(var &amp; 1)
+    end
+
+    array1 = array(&quot;a&quot;=&gt;1, &quot;b&quot;=&gt;2, &quot;c&quot;=&gt;3, &quot;d&quot;=&gt;4, &quot;e&quot;=&gt;5)
+    array2 = array(6, 7, 8, 9, 10, 11, 12)
+
+    array_filter(array1, &quot;odd&quot;).should == array('a' =&gt; 1, 'c' =&gt; 3, 'e' =&gt; 5)
+    array_filter(array2, &quot;even&quot;).should == array(0 =&gt; 6, 2 =&gt; 8, 4 =&gt; 10, 6 =&gt; 12)
   end
 
-  it &quot;parses a crazy regexp without crashing&quot; do
-    php_to_ruby_eval(%Q{ $ext = preg_replace( '|.*/([a-z0-9]+)|', '$1', $_SERVER['CONTENT_TYPE'] ); })
+  it &quot;supports array_filter without a callback&quot; do
+    entry = array(0 =&gt; 'foo', 1 =&gt; false, 2 =&gt; -1, 3 =&gt; nil, 4 =&gt; '')
+    array_filter(entry).should == array(0 =&gt; 'foo', 2 =&gt; -1)
+  end
+
+  it &quot;supports array_unshift&quot; do
+    queue = array(&quot;bar&quot;)
+    arary_unshift(queue, &quot;foo&quot;)
+    queue.should == array(&quot;foo&quot;, &quot;bar&quot;)
+
+    queue = array(&quot;orange&quot;, &quot;banana&quot;)
+    array_unshift(queue, &quot;apple&quot;, &quot;raspberry&quot;)
+    queue.should == array(&quot;apple&quot;, &quot;raspberry&quot;, &quot;orange&quot;, &quot;banana&quot;)
+  end
+
+  it &quot;supports in_array&quot; do
+    os = array(&quot;Mac&quot;, &quot;NT&quot;, &quot;Irix&quot;, &quot;Linux&quot;)
+    in_array(&quot;Irix&quot;, os).should == true
+    in_array(&quot;mac&quot;, os).should == false
+
+    in_array(array('1', '2', '3'), 2).should == true
+    in_array(array('1', '2', '3'), 2, true).should == false
+  end
+
+  it &quot;supports array_key_exists&quot; do
+    search_array = array('first' =&gt; 1, 'second' =&gt; 4)
+    array_key_exists('first', search_array).should == true
   end
   
   it &quot;creates a 1-based array&quot; do
@@ -84,4 +272,1707 @@ describe &quot;Transforms Php for arrays&quot; do
     php_to_ruby_eval(%Q{ array(1, 1, 1, 1,  1, 8 =&gt; 1,  4 =&gt; 1, 19, 3 =&gt; 13); }).should ==
       array(0 =&gt; 1, 1 =&gt; 1, 2 =&gt; 1, 3 =&gt; 13, 4 =&gt; 1, 8 =&gt; 1, 9 =&gt; 19)
   end
+
+  it &quot;supports count&quot; do
+    php_to_ruby_eval(%Q{ $a = array(1,2,3); count($a); }).should == 3
+    php_to_ruby_eval(%Q{ $a = array(0 =&gt; 7, 5 =&gt; 9, 10 =&gt; 11); count($a); }).should == 3 
+    php_to_ruby_eval(%Q{ count(null); }).should == 0
+    php_to_ruby_eval(%Q{ count(false); }).should == 1
+  end
+
+  it &quot;supports uasort&quot; do
+    php_to_ruby_eval_file(&quot;spec/fixtures/uasort.php&quot;).should ==
+      array(
+      100 =&gt; array('id' =&gt; 'cent', 'aa' =&gt; 100100),
+      2   =&gt; array('id' =&gt; 'deux', 'aa' =&gt; 22),
+      10  =&gt; array('id' =&gt; 'dix', 'aa' =&gt; 1010),
+      7   =&gt; array('id' =&gt; 'sept', 'aa' =&gt; 77)
+      )
+  end
+
+  it &quot;supports usort&quot; do
+    php_to_ruby_eval_file(&quot;spec/fixtures/usort.php&quot;).should ==
+      array(0 =&gt; 1, 1 =&gt; 2, 2 =&gt; 3, 3 =&gt; 5, 4 =&gt; 6)
+  end
+
+  it &quot;supports strtr with two args&quot; do
+    php_to_ruby_eval(%Q{ $trans = array(&quot;hello&quot; =&gt; &quot;hi&quot;, &quot;hi&quot; =&gt; &quot;hello&quot;); strtr(&quot;hi all, I said hello&quot;, $trans); }).should == 
+      &quot;hello all, I said hi&quot;
+  end
+  it &quot;supports array_splice&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports array_slice&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports natcasesort&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports array_walk&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports array_search&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports key&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports array_key_exists&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports array_flip&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports array_unique&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports array_keys&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports reset&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports array_values&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports sizeof&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports rsort&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports array_merge_recursive&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports array_map&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports count&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports array_multisort&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports asort&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports array_diff&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports array_unshift&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports array_reverse&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports array_intersect&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports list&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports array_merge&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports sort&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports in_array&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports range&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports current&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports uasort&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports prev&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports array_filter&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports array_pop&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports next&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports array_shift&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports each&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports ksort&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports arsort&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports usort&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports array_fill&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports array_pad&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports extract&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports krsort&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end  
+end
+
+describe &quot;Compatible with String functions&quot; do
+  include Ionize::Php::Environment, SpecHelperMethods
+
+  it &quot;supports strcmp&quot; do
+    strcmp(&quot;foo&quot;, &quot;fop&quot;).should == 1
+    strcmp(&quot;fop&quot;, &quot;foo&quot;).should == -1
+    strcmp(&quot;foo&quot;, &quot;foo&quot;).should == 0
+  end
+
+  it &quot;supports substr&quot; do
+    substr(&quot;abcdef&quot;, -1).should     == &quot;f&quot;
+    substr(&quot;abcdef&quot;, -2).should     == &quot;ef&quot;
+    substr(&quot;abcdef&quot;, -3, 1).should  == &quot;d&quot;
+    substr(&quot;abcdef&quot;, 0, -1).should  == &quot;abcde&quot;
+    substr(&quot;abcdef&quot;, 2, -1).should  == &quot;cde&quot;
+    substr(&quot;abcdef&quot;, 4, -4).should  == &quot;&quot;
+    substr(&quot;abcdef&quot;, -3, -1).should == &quot;de&quot;
+  end
+
+  it &quot;supports strstr&quot; do
+    email  = 'name@example.com'
+    strstr(email, '@').should == &quot;@example.com&quot;
+  end
+
+  it &quot;supports strip_tags&quot; do
+    text = '&lt;p&gt;Test paragraph.&lt;/p&gt;&lt;!-- Comment --&gt; &lt;a href=&quot;#fragment&quot;&gt;Other text&lt;/a&gt;';
+    strip_tags(text).should           == &quot;Test paragraph. Other text&quot;
+    strip_tags(text, '&lt;p&gt;&lt;a&gt;').should == '&lt;p&gt;Test paragraph.&lt;/p&gt; &lt;a href=&quot;#fragment&quot;&gt;Other text&lt;/a&gt;'
+  end
+
+  it &quot;supports explode&quot; do
+    pizza  = &quot;piece1 piece2 piece3 piece4 piece5 piece6&quot;
+    pieces = explode(&quot; &quot;, pizza)
+    pieces.should == array(0=&gt;&quot;piece1&quot;, 1=&gt;&quot;piece2&quot;, 2=&gt;&quot;piece3&quot;, 3=&gt;&quot;piece4&quot;, 4=&gt;&quot;piece5&quot;, 5=&gt;&quot;piece6&quot;)
+
+    str = 'one|two|three|four'
+    explode('|', str, 2).should == array(0 =&gt; &quot;one&quot;, 1 =&gt; &quot;two|three|four&quot;)
+    explode('|', str, -1).should == array(0 =&gt; &quot;one&quot;, 1 =&gt; &quot;two&quot;, 2 =&gt; &quot;three&quot;)
+  end
+
+  it &quot;supports implode&quot; do
+    imploded_array = array('lastname', 'email', 'phone')
+    comma_separated = implode(&quot;,&quot;, imploded_array)
+    comma_separated.should == &quot;lastname,email,phone&quot;
+  end
+
+  it &quot;supports split&quot; do
+    php_to_ruby_eval_file(&quot;spec/fixtures/split.php&quot;).should == 
+      array(&quot;04&quot;, &quot;30&quot;, &quot;1973&quot;)      
+  end
+
+  it &quot;supports rtrim&quot; do
+    text = &quot;\t\tThese are a few words :) ...  &quot;
+    rtrim(text).should == &quot;\t\tThese are a few words :) ...&quot;
+    rtrim(text, &quot; \t.&quot;).should == &quot;\t\tThese are a few words :)&quot;      
+    
+    hello  = &quot;Hello World&quot;
+    rtrim(hello, &quot;Hdle&quot;).should == &quot;Hello Wor&quot;
+  end
+
+  it &quot;supports ltrim&quot; do
+    text = &quot;\t\tThese are a few words :) ...  &quot;
+    ltrim(text).should == &quot;These are a few words :) ...  &quot;
+    ltrim(text, &quot; \t.&quot;).should == &quot;These are a few words :) ...  &quot;
+    
+    hello  = &quot;Hello World&quot;
+    ltrim(hello, &quot;Hdle&quot;).should == &quot;o World&quot;
+  end
+
+  it &quot;supports trim&quot; do
+    text   = &quot;\t\tThese are a few words :) ...  &quot;
+    trim(text).should == &quot;These are a few words :) ...&quot;
+    trim(text, &quot; \t.&quot;).should == &quot;These are a few words :)&quot;
+
+    hello  = &quot;Hello World&quot;
+    trim(hello, &quot;Hdle&quot;).should == &quot;o Wor&quot;
+  end
+
+  it &quot;supports strpos&quot; do
+    strpos(&quot;abcdef&quot;, &quot;a&quot;).should == 0
+    strpos(&quot;abcdef&quot;, &quot;b&quot;).should == 1
+    strpos(&quot;abcdef&quot;, &quot;x&quot;).should == false
+    strpos(&quot;abcdefa&quot;, &quot;a&quot;, 1).should == 7
+  end
+
+  it &quot;supports str_replace&quot; do
+    bodytag = str_replace(&quot;%body%&quot;, &quot;black&quot;, &quot;&lt;body text='%body%'&gt;&quot;)
+    bodytag.should == &quot;&lt;body text='black'&gt;&quot;
+    
+    vowels = array(&quot;a&quot;, &quot;e&quot;, &quot;i&quot;, &quot;o&quot;, &quot;u&quot;, &quot;A&quot;, &quot;E&quot;, &quot;I&quot;, &quot;O&quot;, &quot;U&quot;)
+    onlyconsonants = str_replace(vowels, &quot;&quot;, &quot;Hello World of PHP&quot;)
+    onlyconsonants.should == &quot;Hll Wrld f PHP&quot;
+
+    phrase  = &quot;You should eat fruits, vegetables, and fiber every day.&quot;
+    healthy = array(&quot;fruits&quot;, &quot;vegetables&quot;, &quot;fiber&quot;)
+    yummy   = array(&quot;pizza&quot;, &quot;beer&quot;, &quot;ice cream&quot;)
+    newphrase = str_replace(healthy, yummy, phrase)
+    
+    newphrase.should == &quot;You should eat pizza, beer, and ice cream every day.&quot;
+    
+    letters = array('a', 'p')
+    fruit   = array('apple', 'pear')
+    text    = 'a p'
+    output  = str_replace(letters, fruit, text)
+    output.should == &quot;apearpearle pear&quot;
+  end
+
+  it &quot;supports strlen&quot; do
+    str = 'abcdef'
+    strlen(str).should == 6
+    
+    str = ' ab cd '
+    strlen(str).should == 7
+  end
+
+  it &quot;supports md5&quot; do
+    str = 'apple'
+    md5(str).should == '1f3870be274f6c49b3e31a0c6728957f'
+  end
+
+  it &quot;supports chr&quot; do
+    chr(97).should == &quot;a&quot;
+    chr(98).should == &quot;b&quot;
+    chr(99).should == &quot;c&quot;
+  end
+
+  it &quot;supports ord&quot; do
+    ord('a').should == 97
+    ord('b').should == 98
+    ord('c').should == 99
+  end
+
+  it &quot;supports strtolower&quot; do
+    str = &quot;Mary Had A Little Lamb and She LOVED It So&quot;
+    strtolower(str).should == &quot;mary had a little lamb and she loved it so&quot;
+  end
+
+  it &quot;supports strip_tags&quot; do
+    text = '&lt;p&gt;Test paragraph.&lt;/p&gt;&lt;!-- Comment --&gt; &lt;a href=&quot;#fragment&quot;&gt;Other text&lt;/a&gt;'
+    strip_tags(text).should == &quot;Test paragraph. Other text&quot;
+    strip_tags(text, '&lt;p&gt;&lt;a&gt;').should == %q{&lt;p&gt;Test paragraph.&lt;/p&gt; &lt;a href=&quot;#fragment&quot;&gt;Other text&lt;/a&gt;}
+  end
+
+  it &quot;supports stripslashes&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports strrev&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports strcasecmp&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports stristr&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports md5&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports substr_count&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports ord&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports chr&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports sprintf&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports sha1&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports implode&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports strstr&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports explode&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports substr&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports strrpos&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports str_repeat&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports str_word_count&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports htmlspecialchars&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports strpos&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports addslashes&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports strip_tags&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports wordwrap&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports str_replace&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports join&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports print&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports strcmp&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports printf&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports nl2br&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports quoted_printable_decode&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports strtr&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports setlocale&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports str_pad&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports addcslashes&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+
+  it &quot;supports strncmp&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports stripcslashes&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports strtoupper&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+
+  it &quot;supports strtolower&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports chop&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports get_html_translation_table&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end  
+end
+
+
+describe &quot;Compatible with type comparisons functions&quot; do
+  include Ionize::Php::Environment, SpecHelperMethods
+
+  # http://www.blueshoes.org/en/developer/php_cheat_sheet/
+  it &quot;supports type comparisons&quot; do
+    (true == 1).should == true
+    (true == -1).should == true
+    (true == &quot;1&quot;).should == true
+    (true == &quot;0&quot;).should == false
+    (true == &quot;-1&quot;).should == true
+    (true == &quot;1.3&quot;).should == true
+    (true == &quot;1.30&quot;).should == true
+    (true == 1.3).should == true
+    (true == 1.30).should == true
+    (true == array()).should == false
+    (true == &quot;foo&quot;).should == true
+    (true == &quot;&quot;).should == false
+    
+    (false == 0).should == true
+    (false == -1).should == false
+    (false == &quot;-1&quot;).should == false
+    (false == &quot;0&quot;).should == false
+    (false == &quot;1.3&quot;).should == false    
+    (false == &quot;1.30&quot;).should == false
+    (false == 1.3).should == false
+    (false == 1.30).should == false
+    (false == array()).should == false    
+    (false == &quot;&quot;).should == false        
+
+    (1 == &quot;1&quot;).should == true
+    (0 == &quot;0&quot;).should == true
+    (0 == &quot;foo&quot;).should == true
+    (0 == &quot;&quot;).should == true
+    (-1 == &quot;-1&quot;).should == true
+    (&quot;1.3&quot; == &quot;1.30&quot;).should == true
+    (&quot;1.3&quot; == 1.3).should == true
+    (1.3 == &quot;1.30&quot;).should == true    
+  end
+  
+  # http://us2.php.net/language.types.boolean
+  it &quot;supports conversion from cast as (bool) =&gt; to_bool&quot; do
+    &quot;&quot;.to_bool.should == false
+    1.to_bool.should == true
+    -2.to_bool.should == true
+    &quot;foo&quot;.to_bool.should == true
+    2.3e5.to_bool.should == true
+    array(12).to_bool.should == true
+    array().to_bool.should == false
+    &quot;false&quot;.to_bool.should == true
+
+    false.to_bool.should == false
+    0.to_bool.should == false
+    0.0.to_bool.should == false
+    &quot;0&quot;.to_bool.should == false
+    nil.to_bool.should == false
+
+    # Huh?
+    # an object with zero member variables (PHP 4 only)
+
+    # Where?
+    # SimpleXML objects created from empty tags
+  end
+end
+
+
+describe &quot;Compatible with MiscFunctions&quot; do
+  include Ionize::Php::Environment, SpecHelperMethods
+  
+  it &quot;supports define&quot; do
+    define('GREETING', 'Hello world')
+    GREETING.should == &quot;Hello world&quot;
+  end
+
+  it &quot;supports constant&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports defined&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports exit&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports define&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports die&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports eval&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports unpack&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports uniqid&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports pack&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+end
+
+
+describe &quot;Compatible with Math functions&quot; do
+  include Ionize::Php::Environment, SpecHelperMethods
+  
+  it &quot;supports mt_rand&quot; do
+    pending do
+      raise &quot;How do I write a test for this?&quot;
+    end
+  end
+
+  it &quot;supports max&quot; do
+    max(1, 3, 5, 6, 7).should == 7
+    max(array(2, 4, 5)).should = 5
+    max(0, 'hello').should == 0
+    max('hello', 0).should == 'hello'
+    max(-1, 'hello').should == 'hello'
+    max(array(2, 4, 8), array(2, 5, 7)).should == array(2,5,7)
+    max('string', array(2, 5, 7), 42).should == array(2,5,7)
+  end
+
+  it &quot;supports min&quot; do
+    min(2, 3, 1, 6, 7).should == 1
+    min(array(2, 4, 5)).should == 2
+    min(0, 'hello').should == 0
+    min('hello', 0).should == 'hello'
+    min('hello', -1).should == -1
+    min(array(2, 4, 8), array(2, 5, 1)).should == array(2, 4, 8)
+    min('string', array(2, 5, 7), 42).should == 'string'
+  end
+
+  it &quot;supports round&quot; do
+    round(3.4).should         == 3
+    round(3.5).should         == 4
+    round(3.6).should         == 4
+    round(3.6, 0).should      == 4
+    round(5.045, 2).should    == 5.05
+    round(5.055, 2).should    == 5.06
+    round(1.95583, 2).should  == 1.96
+    round(1241757, -3).should == 1242000
+  end
+
+  it &quot;supports abs&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports hexdec&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports pow&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports ceil&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports base_convert&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports round&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports log10&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports sqrt&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports floor&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports dechex&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+end
+
+
+describe &quot;Compatible with DateTime functions&quot; do
+  include Ionize::Php::Environment, SpecHelperMethods
+
+  it &quot;supports date and mktime&quot; do
+    (&quot;July 1, 2000 is on a &quot; + date(&quot;l&quot;, mktime(0, 0, 0, 7, 1, 2000))).should == &quot;July 1, 2000 is on a Saturday&quot;
+
+    date(&quot;M-d-Y&quot;, mktime(0, 0, 0, 12, 32, 1997)).should == &quot;Jan-01-1998&quot;
+    date(&quot;M-d-Y&quot;, mktime(0, 0, 0, 13, 1, 1997)).should  == &quot;Jan-01-1998&quot;
+    date(&quot;M-d-Y&quot;, mktime(0, 0, 0, 1, 1, 1998)).should   == &quot;Jan-01-1998&quot;
+    date(&quot;M-d-Y&quot;, mktime(0, 0, 0, 1, 1, 98)).should     == &quot;Jan-01-1998&quot;
+  end
+
+  it &quot;supports mktime&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports checkdate&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports gmdate&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports time&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports date&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports gmmktime&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports strtotime&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports gmstrftime&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports microtime&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end  
+end
+
+describe &quot;Compatible with Filesystem functions&quot; do
+  include Ionize::Php::Environment, SpecHelperMethods
+  
+  it &quot;supports file_exists&quot; do
+    file_exists(&quot;spec/php_environment_spec.rb&quot;).should == true
+    file_exists(&quot;/foo/bar/biz/quux&quot;).should == false
+  end
+
+  it &quot;supports dirname&quot; do
+    path = &quot;/etc/passwd&quot;
+    dirname(path).should == &quot;/etc&quot;
+  end
+
+  it &quot;supports basename&quot; do
+    path = &quot;/home/httpd/html/index.php&quot;
+    basename(path).should == &quot;index.php&quot;
+    basename(path, &quot;.php&quot;).should == &quot;index&quot;
+  end
+  it &quot;supports unlink&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports filectime&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports realpath&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports is_executable&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports file&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports pathinfo&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports is_readable&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports rmdir&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports clearstatcache&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports fgets&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports file_get_contents&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports is_file&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports mkdir&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports is_uploaded_file&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports fclose&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports dirname&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports fopen&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports fputs&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports feof&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports is_writable&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports move_uploaded_file&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports chmod&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports copy&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports fileperms&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports tempnam&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports basename&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports filesize&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports file_exists&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports is_dir&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports fwrite&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports fread&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+
+end
+
+
+
+describe &quot;Compatible with VariableHandling functions&quot; do
+  # http://us3.php.net/manual/en/ref.var.php
+  include Ionize::Php::Environment, SpecHelperMethods
+
+  it &quot;supports var_dump&quot; do      
+    pending do
+      raise &quot;Not used in Drupal&quot;
+    end
+  end
+
+  it &quot;supports is_array&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports gettype&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports intval&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports empty&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports is_string&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports is_double&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports is_float&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports serialize&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports unserialize&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports is_null&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports is_bool&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports print_r&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports is_numeric&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports unset&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports is_object&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports is_int&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports strval&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+  it &quot;supports isset&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+  
+
+  it &quot;supports isset&quot; do
+    php_to_ruby_eval(%q{ $a = &quot;test&quot;; isset($a); }).should == true
+    php_to_ruby_eval(%q{ $a = &quot;test&quot;; unset($a); isset($a); }).should == false
+    php_to_ruby_eval(%q{ $a = array('test' =&gt; 1, 'hello' =&gt; NULL); isset($a['test']); }).should == true
+    php_to_ruby_eval(%q{ $a = array('test' =&gt; 1, 'hello' =&gt; NULL); isset($a['foo']); }).should == false
+    php_to_ruby_eval(%q{ $a = array('test' =&gt; 1, 'hello' =&gt; NULL); isset($a['hello']); }).should == false
+  end
+
+  it &quot;supports empty&quot; do
+    php_to_ruby_eval(%q{ empty(0); }).should       == true
+    php_to_ruby_eval(%q{ empty(&quot;0&quot;); }).should     == true
+    php_to_ruby_eval(%q{ empty(&quot;&quot;); }).should      == true
+    php_to_ruby_eval(%q{ empty(false); }).should   == true
+    php_to_ruby_eval(%q{ empty(null); }).should    == true
+    php_to_ruby_eval(%q{ empty(array()); }).should == true
+  end
+
+  it &quot;supports is_array&quot; do
+    php_to_ruby_eval(%q{ $yes = array('this', 'is', 'an array'); is_array($yes); }).should == true
+    php_to_ruby_eval(%q{ $no = 'this is a string'; is_array($no); }).should == false
+  end
+
+  it &quot;supports is_numeric&quot; do
+    is_numeric(&quot;42&quot;).should == true
+    is_numeric(1337).should == true
+    is_numeric(&quot;1e4&quot;).should == true
+    is_numeric(&quot;not numeric&quot;).should == false
+    is_numeric(array()).should == false
+    is_numeric(9.1).should == true
+  end
+
+  it &quot;supports intval&quot; do
+    intval(42).should                      == 42
+    intval(4.2).should                     == 4
+    intval('42').should                    == 42
+    intval('+42').should                   == 42
+    intval('-42').should                   == -42
+    intval(042).should                     == 34
+    intval('042').should                   == 42
+    intval(1e10).should                    == 1410065408
+    intval('1e10').should                  == 1
+    intval(0x1A).should                    == 26
+    intval(42000000).should                == 42000000
+    intval(420000000000000000000).should   == 0
+    intval('420000000000000000000').should == 2147483647
+  end
+
+  it &quot;supports intval with a base&quot; do
+    intval(42, 8).should == 42
+    intval('42', 8).should == 34    
+  end
+
+  it &quot;supports is_null&quot; do
+    foo = nil
+    is_null(foo).should == true
+  end
+
+  it &quot;supports serialize&quot; do
+    pending do
+      raise &quot;Not sure how to test for this.. Is it correct if it doesn't serialize to Php's version? &quot;
+    end
+  end
+
+  it &quot;supports unserialize&quot; do
+    pending do
+      raise &quot;Not sure how to test for this.. Is it correct if it doesn't serialize to Php's version? &quot;
+    end
+  end
+end
+
+describe &quot;Compatible with Php info functions&quot; do
+  include Ionize::Php::Environment, SpecHelperMethods
+
+  it &quot;supports extension_loaded&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+
+  it &quot;supports set_time_limit&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+
+  it &quot;supports get_extension_funcs&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+
+  it &quot;supports ini_get&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+
+  it &quot;supports version_compare&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+
+  it &quot;supports phpversion&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+
+  it &quot;supports memory_get_usage&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+
+  it &quot;supports get_cfg_var&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+
+  it &quot;supports phpinfo&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+
+  it &quot;supports ini_set&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+end
+
+
+describe &quot;Compatible with Url functions&quot; do
+  include Ionize::Php::Environment, SpecHelperMethods
+
+  it &quot;supports urldecode&quot; do
+    urldecode('Hello+%3Cb%3Ethere%21%3C%2Fb%3E').should == 'Hello &lt;b&gt;there!&lt;/b&gt;'
+  end
+  
+  it &quot;support parse_url&quot; do
+    url = 'http://username:password@hostname/path?arg=value#anchor'
+    result = parse_url(url)
+    result.should == array('scheme' =&gt; 'http', 'host' =&gt; 'hostname', 'user' =&gt; 'username', 'pass' =&gt; 'password', 'path' =&gt; '/path', 'query' =&gt; 'arg=value', 'fragment' =&gt; 'anchor')
+  end
+end
+
+describe &quot;Compatible with Output control functions&quot; do
+  include Ionize::Php::Environment, SpecHelperMethods
+  it &quot;supports ob_end_clean&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+
+  it &quot;supports ob_start&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+
+  it &quot;supports ob_get_contents&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+
+  it &quot;supports ob_end_flush&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+
+  it &quot;supports ob_get_level&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+end
+
+describe &quot;Compatible with Mysql functions&quot; do
+  include Ionize::Php::Environment, SpecHelperMethods
+
+  it &quot;supports mysql_error&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+
+  it &quot;supports mysqli_query&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+
+  it &quot;supports mysql_query&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+
+  it &quot;supports mysqli_error&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+
+  it &quot;supports mysqli_connect_errno&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+
+  it &quot;supports mysql_connect&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+
+  it &quot;supports mysqli_connect_error&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+
+  it &quot;supports mysqli_real_escape_string&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+
+  it &quot;supports mysql_errno&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+
+  it &quot;supports mysqli_real_connect&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+
+  it &quot;supports mysql_real_escape_string&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+
+  it &quot;supports mysql_select_db&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+
+  it &quot;supports mysqli_errno&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+
+  it &quot;supports mysqli_init&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+
+  it &quot;supports mysqli_fetch_array&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+
+  it &quot;supports mysqli_close&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+
+  it &quot;supports mysql_affected_rows&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+
+  it &quot;supports mysqli_affected_rows&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+
+  it &quot;supports mysqli_get_server_info&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+
+  it &quot;supports mysql_fetch_array&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+
+  it &quot;supports mysqli_fetch_row&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+
+  it &quot;supports mysql_fetch_object&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+
+  it &quot;supports mysql_get_server_info&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+
+  it &quot;supports mysql_close&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+
+  it &quot;supports mysqli_num_rows&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+
+  it &quot;supports mysqli_fetch_object&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+
+  it &quot;supports mysql_num_rows&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+
+  it &quot;supports mysql_fetch_row&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+end
+
+describe &quot;Compatible with Mysql functions&quot; do
+  include Ionize::Php::Environment, SpecHelperMethods
+
+  it &quot;supports trigger_error&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+
+  it &quot;supports debug_backtrace&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+
+  it &quot;supports error_reporting&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+
+  it &quot;supports set_error_handler&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+end
+
+
+describe &quot;Compatible with Zlib functions&quot; do
+  include Ionize::Php::Environment, SpecHelperMethods
+  
+  it &quot;supports gzinflate&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+
+  it &quot;supports zlib_get_coding_type&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+
+  it &quot;supports gzencode&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
+end
+
+describe &quot;Compatible with Zlib functions&quot; do
+  include Ionize::Php::Environment, SpecHelperMethods
+  it &quot;supports iconv&quot; do
+    pending do
+      raise &quot;TODO&quot;
+    end
+  end
 end</diff>
      <filename>spec/php_environment_spec.rb</filename>
    </modified>
  </modified>
  <removed type="array">
    <removed>
      <filename>lib/ionize/compiled_parser.rb</filename>
    </removed>
    <removed>
      <filename>lib/ionize/dhaka/translate/php_to_ruby.rb</filename>
    </removed>
    <removed>
      <filename>lib/ionize/parser.rb</filename>
    </removed>
    <removed>
      <filename>lib/ionize/tokenizer.rb</filename>
    </removed>
  </removed>
  <parents type="array">
    <parent>
      <id>1d969271581c13456312839a3262ea35d4f45940</id>
    </parent>
  </parents>
  <author>
    <name>farleyknight</name>
    <email>farleyknight+github@gmail.com</email>
  </author>
  <url>http://github.com/farleyknight/ionize/commit/0bb5e63ecc6e972508b26e42daab1c87a3bb986e</url>
  <id>0bb5e63ecc6e972508b26e42daab1c87a3bb986e</id>
  <committed-date>2008-11-25T16:36:22-08:00</committed-date>
  <authored-date>2008-11-25T16:36:22-08:00</authored-date>
  <message>Added Php extension</message>
  <tree>5d08a47da46afbef1c263c65cad71317fc3547a9</tree>
  <committer>
    <name>farleyknight</name>
    <email>farleyknight+github@gmail.com</email>
  </committer>
</commit>
