Follow along with the video below to see how to install our site as a web app on your home screen.
Anmerkung: This feature currently requires accessing the site using the built-in Safari browser.
namespace A {
class Config {
public static $vars = array();
}
Config::$vars[ 'name' ] = 'foo';
}
namespace B {
class Config {
public static $vars = array();
}
Config::$vars[ 'name' ] = 'bar';
}
require_once 'a/config.php';
use \A\Config;
echo Config::$vars[ 'name' ]; # foo
In einem Namespace kann alles drin sein
Variablen Funktionen, Klassen...
(und jeweils direkt, ohne Klassenzwang)
Kannst du mir mal bitte ein Beispiel geben?
So hab ichs verstanden und so funktionierts auch mit funktionen:
Main Datei:
Code:<?php namespace MAIN; $test = "main"; echo $test."<br>"; include "include.php"; echo $test."<br>";
Include Datei:
Code:<?php namespace EXTERN; $test = "include"; echo $test."<br>";
Das Ergebnis ist:
main
include
include
also sprich $test wird überschrieben
<?php
namespace MAIN;
$test = "main";
echo $test."<br>";
namespace EXTERN;
$test = "include";
echo $test."<br>";
echo $test."<br>";
namespace A {
$var = 'test';
}