php-general Digest 15 Nov 2008 23:08:05 -0000 Issue 5792
Topics (messages 283319 through 283324):
Re: Variable Argument List
283319 by: Richard Heyes
Re: RegEx to check for non-Latin characters
283320 by: Yeti
283322 by: Behzad
user access/roles/privs functionality
283321 by: bruce
Another question about Google maps
283323 by: tedd
ability to find include files...
283324 by: bruce
Administrivia:
To subscribe to the digest, e-mail:
[EMAIL PROTECTED]
To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]
To post to the list, e-mail:
[EMAIL PROTECTED]
----------------------------------------------------------------------
--- Begin Message ---
> ...
And you might also be interested in func_get_args(), which returns an
array of args passed to the function (don't know what it does if used
outside a function. Probably get an error).
--
Richard Heyes
HTML5 Graphing for FF, Chrome, Opera and Safari:
http://www.rgraph.org (Updated November 1st)
--- End Message ---
--- Begin Message ---
Hi Behzad,
I would try a different approach ...
EXAMPLE (UTF-8):
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Persia</title>
</head>
<body>
<?php
$username = '1aﺠﺟﺝﭻﭽﭼﭺ2b;
$encoding = 'utf-8';
$username = mbStringToArray($username, $encoding);
foreach($username as $char) {
if (strlen($char) == 1) echo $char.' is not a multibyte character<br />';
}
function mbStringToArray ($string, $encoding) {
$strlen = mb_strlen($string);
while ($strlen) {
$array[] = mb_substr($string,0,1,$encoding);
$string = mb_substr($string,1,$strlen,$encoding);
$strlen = mb_strlen($string);
}
return $array;
}
?>
</body>
</html>
As you can see I'm using the multibyte string functions [1] and split
$username into a character by character array.
Then I use strlen() for which an UTF-8 char has a length > 1. Note:
This might change with PHP6.
It also does not check for Persian characters only yet. You would have
to try something like this ...
EXAMPLE (UTF-8):
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Persia</title>
</head>
<body>
<?php
$username = '1aﺠﺟﺝﭻﭽﭼﭺ2b';
$encoding = 'utf-8';
$chars =
'ﺐﺒﺑﺏﭗﭙﭙپﺖﺘﺗﺕﺚﺜﺛﺙﺞﺠﺟﺝﭻﭽﭼﭺﺢﺤﺣﺡﺦﺨﺧﺥﺪﺪﺩﺩﺬﺬﺫﺫﺮﺮﺭﺭﺰﺰﺯﺯﮋﮋژژﺲﺴﺳﺱﺶﺸﺷﺵﺺﺼﺻﺹﺾﻀﺿﺽﻂﻄﻃﻁﻆﻈﻇﻅﻊﻌﻋﻉﻎﻐﻏﻍﻒﻔﻓﻑﻖﻘﻗﻕﮏﮑﮐکﮓﮕﮔگﻞﻠﻟﻝﻢﻤﻣﻡﻦﻨﻧﻥﻮﻮووﻪﻬﻫﻩﯽﻴﻳﻯ';
$username = mbStringToArray($username, $encoding);
foreach($username as $char) {
if (strlen($char) == 1) echo $char.' is not a multibyte character<br />';
if (mb_strpos($chars, $char, 0, $encoding) !== false) echo $char.' is
a Persian character<br />';
}
function mbStringToArray ($string, $encoding) {
$strlen = mb_strlen($string);
while ($strlen) {
$array[] = mb_substr($string,0,1,$encoding);
$string = mb_substr($string,1,$strlen,$encoding);
$strlen = mb_strlen($string);
}
return $array;
}
?>
</body>
</html>
[1] http://in.php.net/manual/en/ref.mbstring.php
[2] http://in.php.net/manual/en/function.strlen.php
--- End Message ---
--- Begin Message ---
Thanks everyone. I guess I find the answer:
* // return true if the $str ONLY consists of Arabic characters and
space-character
public function isArabicString($str)
{
return preg_match('/^([\p{Arabic}]|\s)*$/u', $str);
}
*
PHP 5.1.x or higher is required.
@see: http://www.regular-expressions.info/unicode.html
Cheers,
-b
--- End Message ---
--- Begin Message ---
Hi list...
I need a way of managing users/teams/etc.. implementing roles/access
rights/privs,etc...
I'd like a way of being able to have users "report to" the resource above
them, ie, the ability to have a hierarchical kind of tree approach would be
good as wel, as this would allow different user/mgr/teams to be moved
up/down in the tree as required.
If I can find the right process, I'll implement it in my targeted app. I'd
prefer something that's fairly well compartmentalized.. but if need be, I'm
willing to rip the right system out of it's parent app if I can find one
that's good!!!
I've reviewed the systems in the vtiger/knowledgetree apps.
thoughts/comments/pointers would be useful!
thanks!
--- End Message ---
--- Begin Message ---
Hi gang:
I posted this question on the Google Map Discussion group/list
thingie, but got zip in replies. Maybe someone here might have an
idea.
Here's the url:
http://masoncollision.com/contact.php
In both Safari and FireFox for the Mac (I have not tested it with
other browsers) as the page loads the map border is momentary drawn
twice. The map border is shown stacked one above the other making the
page much longer than it actually is. But immediately thereafter, the
map is drawn correctly and the page returns to the size it's supposed
to be.
I just want to get rid of the momentary flash.
Anyone have any ideas?
Cheers and thanks,
tedd
--
-------
http://sperling.com http://ancientstones.com http://earthstones.com
--- End Message ---
--- Begin Message ---
Hi list...
starting to go through a debug/understanding session of a couple of php web
apps. i'm wondering if there's any kind of tool/method that i can use to see
which files are accessed/included/required when a given page is displayed..
this would allow me to quickly understand the "flow" of the apps. searching
via google hasn't really turned up anything...
thoughts/comments/pointers welcome.
thanks!
--- End Message ---