1.2.995. Preprocessable¶
The following expressions are made of literals or already known values : they may be fully calculated before running PHP. By doing so, this will reduce the amount of work of PHP. This is a micro-optimisation, when this is used once, or the amount of work is small. It may be kept for readability.
<?php
// Building an array from a string
$name = 'PHP'.' '.'7.2';
// Building an array from a string
$list = explode(',', 'a,b,c,d,e,f');
// Calculating a power
$kbytes = $bytes / pow(2, 10);
// This will never change
$name = ucfirst(strtolower('PARIS'));
?>
1.2.995.1. Connex PHP features¶
1.2.995.1.1. Suggestions¶
Do the work yourself, instead of giving it to PHP
1.2.995.1.2. Specs¶
Short name |
Structures/ShouldPreprocess |
Rulesets |
|
Exakat since |
0.8.4 |
PHP Version |
All |
Severity |
Minor |
Time To Fix |
Instant (5 mins) |
Precision |
High |
Examples |
|
Available in |