Answer the question
In order to leave comments, you need to log in
Why is there a php namespace issue?
Hello! I am new to PHP (4 days programming on it). Got to the namespaces.
There are 3 files:
1st - code1.php -
<?php namespace CodeOne;
function sayHi(){
print "Передаю привет из code1";
}
?>
<?php namespace CodeTwo;
function sayHi(){
print "Передаю привет из code2";
}
?>
<?php
require("code1.php");
require("code2.php");
print "файл general.php успешно подключен";
\CodeTwo\sayHi();
?>
Fatal error: Namespace declaration statement has to be the very first statement or after any declare call in the script in C:\OpenServer\domains\asd\code1.php on line 3
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question