FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » how to change old ereg?
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
how to change old ereg? [message #181937] Wed, 26 June 2013 04:41 Go to previous message
astrid.kuhr is currently offline  astrid.kuhr
Messages: 5
Registered: June 2013
Karma:
Junior Member
Hello!

On a webpage I am using phpweather.
It works fine for several years.
But now it causes very many error messages.
I searched in the web, that ereg is not
longer supported and it is to replace with
preg_match.
I try to do this and change

if (ereg("^pw_${type}_([a-z][a-z])(_[A-Z][A-Z])?\.php$", $file, $regs)) {
$output[$regs[1] . $regs[2]] = $languages[$regs[1] . $regs[2]];
}

to

if (preg_match("/^pw_${type}_([a-z][a-z])(_[A-Z][A-Z])?\.php$/", $file, $regs)) {
$output[$regs[1] . $regs[2]] = $languages[$regs[1] . $regs[2]];
}

But now appears:

Notice: Undefined offset: 2 in /var/www/html/phpweather/pw_utilities.php on line 95

But I do not know php.

} elseif (ereg_match('^M?(([0-9]?)[ ]?([0-9])(/?)([0-9]*))SM$',
$temp_visibility_miles . ' ' . $part, $regs)) {

I changed to

} elseif (preg_match('/^M?(([0-9]?)[ ]?([0-9])(/?)([0-9]*))SM$/',
$temp_visibility_miles . ' ' . $part, $regs)) {

But then:

Warning: preg_match() [function.preg-match]: Unknown modifier '?' in /var/www/html/phpweather/phpweather.php on line 329

And very very many other error-messages to.

How can I change it to get it work?

Regards, Astrid
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: FORMS, validating mail was sent
Next Topic: $referrer = $_SERVER['HTTP_REFERER'] echo
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sun Nov 24 22:06:31 GMT 2024

Total time taken to generate the page: 0.04103 seconds