Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Duplicate Static Definition

PHP reports when the same static variable has been declared twice in the same context.

PHP code

<?php

namespace A { 
	function foo() {
        static $s;
        $s = 1;

        static $s;
        echo $s;
    }
}

?>

Before

11

After

Duplicate declaration of static variable $s

PHP version change

This behavior changed in 8.3.

Error Messages

Extension

Analyzer

© 2023-2026, Damien Seguy - Exakat