php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #15689 more variable type should be added
Submitted: 2002-02-23 11:29 UTC Modified: 2011-01-01 00:31 UTC
From: Xuefer at 21cn dot com Assigned:
Status: Wont fix Package: *General Issues
PHP Version: 4.1.1 OS:
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2002-02-23 11:29 UTC] Xuefer at 21cn dot com
php class has no `operator` behave like c++
so, it's quite different between user-defined-object and internal-variable-type

i suggest that wide-string type should be added.
which behave like wchar_t in vc, but more powerful

wide-string is not that mbstring
mbstring is an extension not internal type

every char of wide-string is wide-char(wchar), both ascii and multibyte-char
there's also a bunch of wide-string operating function in i18n
mbstring is so complexity that use more cpu-time
wide-string take more memory but simple to process

samples:
$str = "string"; // This is a normal string
$wstr = L"string"; // This is a wide-string
echo strlen($str); // 6
echo strlen($wstr); // also 6
echo memsize($wstr); // 6
echo memsize($wstr); // 12
echo $str == $wstr; // true
echo $str === $wstr; // false

"\x20"; // normal string
L"\x20"; // wide-string
L"\x4c3a"; // wide-string

and
echo preg_replace(L"/abc/", "def", "abcdef");
should also works for matching wide-string
if (strpos(L"abc", L"def") === false) .....;

see? quite different from "mbstring"
but.. if adding wchar_t support to every string function make it slower, i'd like to have a set of "w" prefix functions such as wstrcmp wstrpos wpreg_replace
not "mb" :p

if php preferer mbstring rather than wchar_t
at least, make mbstring internal, not as extension.
when compiled without mbstring, all mbstring-type is processed exactly like normal string.

that's all

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-01-01 00:31 UTC] jani@php.net
-Status: Open +Status: Wont fix -Package: Feature/Change Request +Package: *General Issues
 [2011-01-01 00:31 UTC] jani@php.net
Rather opposite: We should remove all types and make everything classes and objects. :) Won't happen.
 
PHP Copyright © 2001-2017 The PHP Group
All rights reserved.
Last updated: Sun Nov 19 01:31:42 2017 UTC