Skip to content

Instantly share code, notes, and snippets.

@zhiephie
Created February 11, 2015 16:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zhiephie/3bd3aa9d284851b5ee18 to your computer and use it in GitHub Desktop.
Save zhiephie/3bd3aa9d284851b5ee18 to your computer and use it in GitHub Desktop.
namespace
#contoh
index.php
Test
didalam folder test ada file :
- Nama.php
#script :
- file Nama.php
<?php
namespace Test; //namespace kita deklarasikan
class Nama {
function kamu()
{
echo 'nama saya kamu';
}
}
#lalu save
index.php
<?php
include_once 'Test/Nama.php';
$car = new \Nama;
$car->kamu();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment