Category : namespaces

An example of a non-compound PHP namespace: namespace Html; An example of a compound PHP namespace: namespace NSHtml; If I try to import a non-compound PHP namespace, I get the following error: Warning: The use statement with non-compound name ‘Html’ has no effect in /home/public_html/Samples/PHP/Namespaces/ImportNamespace1.php on line 34 Next, I tried using a compound PHP ..

Read more

I am in the process of making a website with a router using the namesapaces for class. But an error occurs (see title). Here is the layout of my files: And here is my index.php (problematic file): <?php require ‘../vendor/autoload.php’; include_once "../src/PHP/functions.php"; $router = new AppRouterRouter(getURL()); $router->get(”, function () { include "home.php"; }); $router->get(‘/’, function ..

Read more

sometimes in some libraries like csv league, I see the use keyword but I can’t understand why? see the following example: use Generator; use SplFileObject; use function filter_var; use function get_class; use function mb_strlen; use function rawurlencode; use function sprintf; use function str_replace; use function str_split; use function strcspn; use function strlen; use const FILTER_FLAG_STRIP_HIGH; ..

Read more

I’m working on the PHP Project which is encrypted. It provides the main php file which including all the functions like get information and rendering the UI. main.php // Encrypted, for explaining only. Cannot be edited require "Smarty.class.php"; include .. … .. $template = new Smarty(); $database =…… index.php // Can edit include "main.php"; $user ..

Read more