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:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        [EMAIL PROTECTED]


----------------------------------------------------------------------
--- Begin Message ---
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


      


--- End Message ---
--- Begin Message ---
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

--- End Message ---
--- Begin Message ---
On Sat, May 17, 2008 at 2:17 AM, Chris W <[EMAIL PROTECTED]> 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.

--- End Message ---
--- Begin Message ---
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    |
+----------------------------------------+

--- End Message ---
--- Begin Message ---
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


--- End Message ---
--- Begin Message ---
hi!

Does anyone know how to convert euro ?

For example;

French to German, Italy to French currency
so on.


Regards,
Yi\ui

--- End Message ---
--- Begin Message ---
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

--- End Message ---

Reply via email to