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
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
5 + 38 = ?
Subscribe to this entry?

 
 [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-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 16 09:01:28 2024 UTC