-
Notifications
You must be signed in to change notification settings - Fork 0
Converting legacy code to php 5.3
rburghol edited this page Dec 20, 2021
·
3 revisions
- xajax libs (fix locally first, then later explore the new version of xajax)
- modeling libs - ereg to preg
- HSPF - hspf.defaults.php has ereg_format variable, which needs to be enclosed by a beginning and ending "/" since it is replaced with preg
- This should be tested in the UCI parsing routines, and in the lib_hydrology parsing of exp files when loading WDM's
- lib_hydrology.php
- data_functions.php
- HSPF - hspf.defaults.php has ereg_format variable, which needs to be enclosed by a beginning and ending "/" since it is replaced with preg
Code 1: Code to look at differences in syntax when replacing "split" with "explode" and "ereg_replace" with "preg_replace".
<?php
$s = "7|All (RW-Del),6|Read/Write,4|Read-Only,0|None:gpid:gpname::0";
$d = split("\|", $s);
$e = explode("|", $s);
print("d: " . print_r($d,1) . "\n");
print("e: " . print_r($e,1) . "\n");
?>
[rob@deq2 test]$ cat test_preg_replace.php
<?php
$gname = "Mixed8128u7KLwetr&Numbers9012";
$e = ereg_replace("[^a-zA-Z0-9_]",'',$gname);
$f = preg_replace("/[^a-zA-Z0-9_]/",'',$gname);
print("e: " . print_r($e,1) . "\n");
print("e: " . print_r($f,1) . "\n");
?>