I was testing PHP code with VLD and noticed something odd. If I left off the final closing PHP then there were fewer ops. Here is an example:
[sourcecode lang=”php”]
<?php
$first_name = ‘Joseph’;
$last_name = ‘Scott’;
?>
[/sourcecode]
has 6 ops:
line # * op operands ------------------------------------------ 2 0 > EXT_STMT 1 ASSIGN !0, 'Joseph' 3 2 EXT_STMT 3 ASSIGN !1, 'Scott' 5 4 EXT_STMT 5 > RETURN 1
The same file, minus the closing PHP tag:
[sourcecode lang=”php”]
<?php
$first_name = ‘Joseph’;
$last_name = ‘Scott’;
[/sourcecode]
has only 5 ops:
line # * op operands ----------------------------------------- 2 0 > EXT_STMT 1 ASSIGN !0, 'Joseph' 3 2 EXT_STMT 3 ASSIGN !1, 'Scott' 4 4 > RETURN 1
I trimmed the VLD output to make it easier to read.
Boils down to an extra EXT_STMT op when the closing PHP tag is included.