|
Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com |
php-general-digest-help
lists.php.net
Date: Sat May 17 2008 - 12:06:13 CDT
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
php-general Digest 17 May 2008 17:06:13 -0000 Issue 5464
Topics (messages 274462 through 274468):
problem with htmlspecialchars in version5.2.5
274462 by: It flance
String searching
274463 by: Chris W
274464 by: Daniel Brown
274465 by: Richard Heyes
Re: Threads PHP
274466 by: Per Jessen
euro currency convert
274467 by: Yui Hiroaki
274468 by: M. Sokolewicz
Administrivia:
To subscribe to the digest, e-mail:
php-general-digest-subscribe
lists.php.net
To unsubscribe from the digest, e-mail:
php-general-digest-unsubscribe
lists.php.net
To post to the list, e-mail:
php-general
lists.php.net
----------------------------------------------------------------------
attached mail follows:
Hi,
this statement:
echo nl2br(htmlspecialchars($row['jobdescription'], ENT_QUOTES, 'UTF-8'));
works for php4.3.10 but not for php5.2.5
I am wondering if i am missing something.
Thank you
attached mail follows:
I need to find the position of the first character in the string
(searching from the end) that is not one of the characters in a set. In
this case the set is [0-9a-zA-z-_]
I guess to be even more specific, I want to split a string into to parts
the first part can contain anything and the second part must be only in
the set described above.
What is the easiest way to do this?
--
Chris W
KE5GIX
"Protect your digital freedom and privacy, eliminate DRM,
learn more at http://www.defectivebydesign.org/what_is_drm"
Ham Radio Repeater Database.
http://hrrdb.com
attached mail follows:
On Sat, May 17, 2008 at 2:17 AM, Chris W <2wsxdr5
cox.net> wrote:
> I need to find the position of the first character in the string
> (searching from the end) that is not one of the characters in a set. In
> this case the set is [0-9a-zA-z-_]
To find the position of a specific character, RTFM on strpos().
For those not existing in your condition, I'd recommend
everythingbut(), but it's yet to be included in the core. ;-P
> I guess to be even more specific, I want to split a string into to parts
> the first part can contain anything and the second part must be only in
> the set described above.
You can split a string by doing something as simple as this:
<?php
$str = "abcdefghijklmnopqrstuvwxyz";
$d = $str[5]; // $d == position - 1, because count always begins with 0
?>
So to walk backward through the string, while it's not very clean,
you could do:
<?php
$str = "ABCDEF01234567789";
for($i=strlen($str);$i>0;$i--) {
if(preg_match('/[g-z]/i',$str[$i])) {
// Handle your "this is a bad character" condition(s).
// break; /* Or, optionally, continue. */
}
}
?>
Not pretty, but if my mind is still working at 2:30a (EDT), it
should help you out.
--
</Daniel P. Brown>
Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just
$59.99/mo. with no contract!
Dedicated servers, VPS, and hosting from $2.50/mo.
attached mail follows:
Chris W wrote:
> I need to find the position of the first character in the string
> (searching from the end) that is not one of the characters in a set. In
> this case the set is [0-9a-zA-z-_]
>
> I guess to be even more specific, I want to split a string into to parts
> the first part can contain anything and the second part must be only in
> the set described above.
>
> What is the easiest way to do this?
>
There's something here, imaginatively called blah(), which does what you
require:
http://www.phpguru.org/preg/example.phps
--
Richard Heyes
+----------------------------------------+
| Access SSH with a Windows mapped drive |
| http://www.phpguru.org/sftpdrive |
+----------------------------------------+
attached mail follows:
Richard Heyes wrote:
>
> > Summary: experimental implementation of threads
>
> The word "experimental" makes me shudder.
"PHP" and "threads" in the same sentence make me shudder too. There are
just some things you shouldn't do with an interpreted language IMHO.
/Per Jessen, Zürich
attached mail follows:
hi!
Does anyone know how to convert euro ?
For example;
French to German, Italy to French currency
so on.
Regards,
Yi\ui
attached mail follows:
Yui Hiroaki wrote:
> hi!
>
> Does anyone know how to convert euro ?
>
> For example;
>
> French to German, Italy to French currency
> so on.
>
>
> Regards,
> Yi\ui
I must be missing something, but the French Euro is the exact same
currency as the German Euro, as is the Italian euro. There is nothing to
convert; 1 euro = 1 euro, regardless of which country (that has the
euro) you look at.
- Tul
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]