[PHP] Regexp and Arrays

2010-01-02 Thread Allen McCabe
I have been plauged for a few days by this, can anyone see a problem with this function?? function printByType($string, $mode) { (string) $string; $lengths = array( 'VARCHAR' = 10 , 'TINYINT' = 1 , 'TEXT' = 10 , 'DATE' = 7 , 'SMALLINT' = 1 , 'MEDIUMINT' = 2 ,

Re: [PHP] Regexp and Arrays

2010-01-02 Thread shiplu
There can be a problem. But do you see a problem?? if yes. what is it? May be we can find the solution. -- Shiplu Mokaddim My talks, http://talk.cmyweb.net Follow me, http://twitter.com/shiplu SUST Programmers, http://groups.google.com/group/p2psust Innovation distinguishes bet ... ... (ask

Re: [PHP] Regexp and Arrays

2010-01-02 Thread Mari Masuda
On a quick glance I don't think you are doing the casting correctly. For example, you have stuff like: (string) $string; and (string) $key; (int) $val; and (int) $length_value = $match[1]; and the casted value is not being saved anywhere. I believe it should be something like $string =

Re: [PHP] Regexp and Arrays

2010-01-02 Thread Allen McCabe
I think part of the problem may lie in the use of variables in regular expressions. I am trying to use the perl-style preg_match(), but the regular expression values that it checks on each iteration of the foreach loop checks for a different value (hence, the use of a variable). On Sat, Jan 2,