These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | declare(strict_types = 1); |
||
3 | // Since we want to profile all the code, include Profiler class before vendor/autoload.php. |
||
4 | require_once 'class/Profiler.php'; |
||
5 | use Converter\Tools\Profiler; |
||
6 | $profiler = new Profiler(); |
||
7 | //Start the Profiler |
||
8 | $profiler->Start(); |
||
9 | |||
10 | //Autoload dependencies |
||
11 | require_once('vendor/autoload.php'); |
||
12 | use Converter\Core\Number2Text; |
||
13 | use Converter\Demo\Generator; |
||
0 ignored issues
–
show
|
|||
14 | |||
15 | //Generate random numbers and print results of conversion |
||
16 | $zerofill = false; |
||
17 | $source = Generator::generate(); |
||
18 | $number = new Number2Text($source); |
||
19 | $number->currency(true); |
||
20 | |||
21 | $power = Generator::$exponent; |
||
22 | $base = Generator::$mantissa; |
||
23 | $base_check = strlen((string)($base / 10)); |
||
24 | |||
25 | if ($base_check == 1) { |
||
26 | $base = $base / 10; |
||
27 | $power += 1; |
||
28 | } |
||
29 | |||
30 | echo '<strong>Input Number: </strong>' . $source . '<br><br>'; |
||
31 | echo '<strong>Exponential form: </strong>'; |
||
32 | if ($base != 0) { |
||
33 | echo $zerofill === true ? $base . '•10' : 'RND•e'; |
||
34 | echo Generator::$sign == '-' ? '-' : '+'; |
||
35 | echo "<span style='position: relative; bottom: 1ex; font-size: 70%;'>" . $power . "</span>"; |
||
36 | } |
||
37 | echo '<br><br>'; |
||
38 | echo '<strong>Converted string: </strong>' . mb_strtoupper($number->convert()); |
||
39 | echo '<br><br>'; |
||
40 | |||
41 | //Stop Profiler and show total execution time |
||
42 | $profiler->Stop(); |
||
43 |
Let’s assume that you have a directory layout like this:
and let’s assume the following content of
Bar.php
:If both files
OtherDir/Foo.php
andSomeDir/Foo.php
are loaded in the same runtime, you will see a PHP error such as the following:PHP Fatal error: Cannot use SomeDir\Foo as Foo because the name is already in use in OtherDir/Foo.php
However, as
OtherDir/Foo.php
does not necessarily have to be loaded and the error is only triggered if it is loaded beforeOtherDir/Bar.php
, this problem might go unnoticed for a while. In order to prevent this error from surfacing, you must import the namespace with a different alias: