File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -58,6 +58,7 @@ Then the main code follows: First a temporary class entry value ``tmp_ce`` is de
5858``INIT_CLASS_ENTRY ``. After that the class is registered in the Zend Engine using ``zend_register_internal_class ``. This
5959function also returns the final class entry, so it can be stored in the global variable declared above.
6060
61+ 
6162To test that the class was registered properly you can run ``php --rc Test ``, which should give an output along the
6263following lines:
6364
@@ -78,6 +79,33 @@ following lines:
7879
7980
8081
82+ 
83+ Register a class with a specific namespace:
84+ -------------------------------------------- 
85+ to register your class under a specific namespace you will need to use ``INIT_NS_CLASS_ENTRY `` instead of ``INIT_CLASS_ENTRY ``
86+ 
87+ the ``INIT_NS_CLASS_ENTRY `` macro takes additional parameter -as a second parameter- to specify the namespace string.
88+ 
89+ so our ``Test `` example would be as follows::
90+ 
91+     zend_class_entry *test_ce; 
92+ 
93+     const zend_function_entry test_functions[] = { 
94+         PHP_FE_END 
95+     }; 
96+ 
97+     PHP_MINIT_FUNCTION(test) 
98+     { 
99+         zend_class_entry tmp_ce; 
100+         INIT_NS_CLASS_ENTRY(tmp_ce, "TestNamespace", "Test", test_functions); 
101+ 
102+         test_ce = zend_register_internal_class(&tmp_ce TSRMLS_CC); 
103+ 
104+         return SUCCESS; 
105+     } 
106+ 
107+ 
108+ 
81109Method definition and declaration
82110--------------------------------- 
83111
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments