Last features in PHP 7.1 (part c)

This is the third part of our series about last features in PHP 7.1. See ‘Upcoming features in PHP 7.1 (part a)‘ and‘More upcoming features in PHP 7.1 (part b)‘. PHP 7.1 is now RC1 since our last article, so better dive into the code fast. We are now presenting the last batch of […]

Const behavior in PHP 7

Const behavior in PHP 7 I always thought const behavior to be like class. Well, of course, beside the obvious differences, const and class were compile-time structures. They are complete at compilation, and could be op-coded and cached. This is unlike the slower define() function (for const), which requires PHP execution to be creating constants. This […]

Static analysis helps migrate to PHP 7

Static analysis helps migrate to PHP 7 Static analysis is the analyze of PHP code without running it. The traditional way to do this is to read the code and understand it. The modern way is to use a static analysis software. Including static analysis as a regular sanity check in your coding process raises […]

7 new PHP static analysis with Exakat 0.6.0

7 new PHP static analysis No less than 7 new analyzers for Exakat, since last week version. Here is a quick review, as they are both varied and interesting. Identical conditions Identical conditions spots members of an complex logical expression that are identical. When several conditions are chained, it happens that some of the conditions […]

What is the largest PHP code base?

When testing the exakat static analysis engine, we need to run it on real code : even better, use the largest PHP code base available. Open Source projects are a real blessing there, since they come in different shapes and stripes. Some projects dates back from PHP 3 and evolved until now, some are directly […]

PHP Heredoc 的樂趣

Heredoc PHP Heredoc PHP 語法是PHP裏面寫入一大塊的文字的方式,不是傳統的使用單引號,雙引號字符串分隔符。他依賴於<<<和一個用來表示這個字符串的結束的標示符。<?php $string = <<<STRING$x elephpants STRING ; ?>Heredoc 還有一個Nowdoc替代, 它是Heredo的“單引號版本”。 它實際上在標示符定義上就是用了單引號,並且不會替換它裏面的變量值。<?php $string = <<<‘STRING’$x elephpants STRING ; ?>Nowdoc 很少被使用。在Heredoc/Nowdoc的使用中,僅僅只有3%使用Nowdoc的語法。這個可能是因爲Nowdoc最近才被加到語言中(PHP 5.3),又或者是典型的擔心未來可能會要使用字符串中的變量。

什麼是可行的靜態分析

靜態分析指在不執行代碼的情況下審查代碼。這樣的代碼審查可以是一個項目的一個階段,或者當代碼被轉移給一個新的程序員(他也可能是6個月後的你自己)的時候自然發生。在兩種情況下,目的都是通過閱讀代碼找到缺陷,理解它和找到不可能的情況。