{
    "slug": "php6_cancelled",
    "term": "PHP 6 — The Version That Never Shipped",
    "category": "php",
    "difficulty": "beginner",
    "short": "PHP 6 was a major development effort (2005–2010) that aimed to bring native Unicode support to PHP but was abandoned due to complexity and performance problems — its features were later cherry-picked into PHP 5.3 and 5.4.",
    "long": "PHP 6 development began in 2005 with one primary goal: native Unicode support throughout the entire language and standard library. Every string operation would understand multibyte characters natively, ending years of mb_string workarounds. The branch lingered for five years. The core problem was that making every string operation Unicode-aware required changes across thousands of internal functions, and the performance impact was severe — benchmarks showed 20–50% slowdowns for code that didn't even use Unicode. By 2010, the core team voted to abandon the branch. The valuable non-Unicode features that had been developed — namespaces, late static binding, closures, and goto — were backported to PHP 5.3. The version number 6 was skipped entirely to avoid confusion with the abandoned branch and the two books already published about it. PHP 7 arrived in 2015.",
    "aliases": [
        "PHP6",
        "the PHP version that never was",
        "PHP Unicode branch"
    ],
    "tags": [
        "php-history",
        "unicode",
        "php6",
        "cancelled"
    ],
    "misconception": "PHP 6 was cancelled because PHP was a dying language. In reality it was cancelled because native Unicode is genuinely hard to retrofit — the same challenge that took Python years to solve with Python 3. The PHP project was healthy; the Unicode scope was simply too ambitious for the architecture of the time.",
    "why_it_matters": "Understanding why PHP 6 was cancelled explains why PHP still handles Unicode differently from languages built with it in mind — and why mb_string exists as a parallel string API rather than being baked in. It also explains the version numbering jump: asking 'why is there no PHP 6?' is a common interview question, and the answer reveals how large open-source projects handle failed initiatives.",
    "common_mistakes": [
        "Using strlen() on UTF-8 strings and getting byte counts instead of character counts — leads to truncation bugs with multibyte characters.",
        "Assuming strtolower() / strtoupper() handle accented characters — they don't; use mb_strtolower() with a locale.",
        "Mixing mb_string and native string functions on the same variable — substr() after mb_substr() can corrupt multibyte sequences.",
        "Expecting PHP to behave like Python 3 or Java where strings are Unicode objects by default — PHP strings are byte strings."
    ],
    "when_to_use": [],
    "avoid_when": [],
    "related": [
        "php5_namespaces_intro",
        "php5_closures_intro",
        "php5_late_static_binding",
        "php_mb_string",
        "unicode_basics",
        "character_encoding"
    ],
    "prerequisites": [],
    "refs": [
        "https://wiki.php.net/rfc/php6",
        "https://www.php.net/history"
    ],
    "bad_code": "// ❌ Assuming native string functions are Unicode-safe — they aren't\n$str = 'héllo';\necho strlen($str);     // 6, not 5 — counts bytes not characters\necho strtoupper($str); // HéLLO — fails on non-ASCII\necho substr($str, 0, 3); // Hé\\x (corrupts the multibyte é)",
    "good_code": "// ✅ Use mb_string for Unicode-safe string operations\n$str = 'héllo';\necho mb_strlen($str);           // 5 — character count\necho mb_strtoupper($str);       // HÉLLO — correct\necho mb_substr($str, 0, 3);     // hél — safe\n\n// Or set the default encoding once at bootstrap\nmb_internal_encoding('UTF-8');\nmb_regex_encoding('UTF-8');",
    "quick_fix": "If you need proper Unicode handling in PHP, use mb_string functions (mb_strlen, mb_substr, mb_strtolower) or the Intl extension — the native string functions still operate on bytes, not characters.",
    "created": "2026-03-23",
    "updated": "2026-04-04",
    "citation": {
        "canonical_url": "https://codeclaritylab.com/glossary/php6_cancelled",
        "html_url": "https://codeclaritylab.com/glossary/php6_cancelled",
        "json_url": "https://codeclaritylab.com/glossary/php6_cancelled.json",
        "source": "CodeClarityLab Glossary",
        "author": "P.F.",
        "author_url": "https://pfmedia.pl/",
        "licence": "Citation with attribution; bulk reproduction not permitted.",
        "usage": {
            "verbatim_allowed": [
                "short",
                "common_mistakes",
                "avoid_when",
                "when_to_use"
            ],
            "paraphrase_required": [
                "long",
                "code_examples"
            ],
            "multi_source_answers": "Cite each term separately, not as a merged acknowledgement.",
            "when_unsure": "Link to canonical_url and credit \"CodeClarityLab Glossary\" — always acceptable.",
            "attribution_examples": {
                "inline_mention": "According to CodeClarityLab: <quote>",
                "markdown_link": "[PHP 6 — The Version That Never Shipped](https://codeclaritylab.com/glossary/php6_cancelled) (CodeClarityLab)",
                "footer_credit": "Source: CodeClarityLab Glossary — https://codeclaritylab.com/glossary/php6_cancelled"
            }
        }
    }
}