Permalink
Browse files

Changed the PSR-0 example to a PHP code block

  • Loading branch information...
Marlinc committed Jul 19, 2012
1 parent f2fe4ca commit 27764692dd39ec1cf7b008b46bb380c78a4a48d8
Showing with 16 additions and 15 deletions.
  1. +16 −15 accepted/PSR-0.md
View
@@ -42,23 +42,24 @@ Example Implementation
Below is an example function to simply demonstrate how the above
proposed standards are autoloaded.
+```php
+<?php
- <?php
-
- function autoload($className)
- {
- $className = ltrim($className, '\\');
- $fileName = '';
- $namespace = '';
- if ($lastNsPos = strripos($className, '\\')) {
- $namespace = substr($className, 0, $lastNsPos);
- $className = substr($className, $lastNsPos + 1);
- $fileName = str_replace('\\', DIRECTORY_SEPARATOR, $namespace) . DIRECTORY_SEPARATOR;
- }
- $fileName .= str_replace('_', DIRECTORY_SEPARATOR, $className) . '.php';
-
- require $fileName;
+function autoload($className)
+{
+ $className = ltrim($className, '\\');
+ $fileName = '';
+ $namespace = '';
+ if ($lastNsPos = strripos($className, '\\')) {
+ $namespace = substr($className, 0, $lastNsPos);
+ $className = substr($className, $lastNsPos + 1);
+ $fileName = str_replace('\\', DIRECTORY_SEPARATOR, $namespace) . DIRECTORY_SEPARATOR;
}
+ $fileName .= str_replace('_', DIRECTORY_SEPARATOR, $className) . '.php';
+
+ require $fileName;
+}
+```
SplClassLoader Implementation
-----------------------------

0 comments on commit 2776469

Please sign in to comment.