php-general Digest 3 Jan 2010 14:18:42 -0000 Issue 6519

Topics (messages 300782 through 300786):

Re: Regexp and Arrays
        300782 by: shiplu
        300783 by: Mari Masuda
        300784 by: Allen McCabe

Instll php on Window 2003 64Bit questions
        300785 by: Edward S.P. Leong
        300786 by: Ashley Sheridan

Administrivia:

To subscribe to the digest, e-mail:
        php-general-digest-subscr...@lists.php.net

To unsubscribe from the digest, e-mail:
        php-general-digest-unsubscr...@lists.php.net

To post to the list, e-mail:
        php-gene...@lists.php.net


----------------------------------------------------------------------
--- Begin Message ---
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 Steve Jobs the rest)

--- End Message ---
--- Begin Message ---
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 = (string) $string; in order to 
assign the casted value back to the variable.  In the third example, you 
probably meant $length_value = (int) $match[1];

On Jan 2, 2010, at 1:09 PM, Allen McCabe wrote:

> 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
>    , 'INT' => 2
>    , 'BIGINT' => 3
>    , 'FLOAT' => 4
>    , 'DOUBLE' => 4
>    , 'DECIMAL' => 4
>    , 'DATETIME' => 10
>    , 'TIMESTAMP' => 10
>    , 'TIME' => 7
>    , 'YEAR' => 4
>    , 'CHAR' => 7
>    , 'TINYBLOB' => 10
>    , 'TINYTEXT' => 10
>    , 'BLOB' => 10
>    , 'MEDIUMBLOB' => 10
>    , 'MEDIUMTEXT' => 10
>    , 'LONGBLOB' => 10
>    , 'LONGTEXT' => 10
>    , 'ENUM' => 5
>    , 'SET' => 5
>    , 'BIT' => 2
>    , 'BOOL' => 1
>    , 'BINARY' => 10
>    , 'VARBINARY' => 10);
>  $types = array(
>    'VARCHAR' => 'text'
>    , 'TINYINT' => 'text'
>    , 'TEXT' => 'textarea'
>    , 'DATE' => 'text'
>    , 'SMALLINT' => 'text'
>    , 'MEDIUMINT' => 'text'
>    , 'INT' => 'text'
>    , 'BIGINT' => 'text'
>    , 'FLOAT' => 'text'
>    , 'DOUBLE' => 'text'
>    , 'DECIMAL' => 'text'
>    , 'DATETIME' => 'text'
>    , 'TIMESTAMP' => 'text'
>    , 'TIME' => 'text'
>    , 'YEAR' => 'text'
>    , 'CHAR' => 'text'
>    , 'TINYBLOB' => 'textarea'
>    , 'TINYTEXT' => 'textarea'
>    , 'BLOB' => 'textarea'
>    , 'MEDIUMBLOB' => 'textarea'
>    , 'MEDIUMTEXT' => 'textarea'
>    , 'LONGBLOB' => 'textarea'
>    , 'LONGTEXT' => 'textarea'
>    , 'ENUM' => 'text'
>    , 'SET' => 'text'
>    , 'BIT' => 'text'
>    , 'BOOL' => 'text'
>    , 'BINARY' => 'text'
>    , 'VARBINARY' => 'text');
> 
>  switch ($mode)
>  {
>   case 'INPUT_LENGTH':
>    foreach ($lengths as $key => $val)
>    {
>     (string) $key;
>     (int) $val;
> 
>     // DETERMINE LENGTH VALUE eg. int(6) GETS 6
>     preg_match('#\((.*?)\)#', $string, $match);
>     (int) $length_value = $match[1];
> 
>     // SEARCH
>     $regex = "/" . strtolower($key) . "/i";
>     $found = preg_match($regex, $string);
> 
>     if ($found !== false)
>     {
>      // DETERMINE ADD INTEGER eg. If the length_value is long enough,
> determine number to increase html input length
>      switch ($length_value)
>      {
>       case ($length_value <= 7):
>        return $length_value;
>       break;
>       case ($length_value > 7 && $length_value < 15):
>        return $val += ($length_value/2);
>       break;
>       case ($length_value > 14 && $length_value < 101):
>        $result = ($length_value / 5);
>        $divide = ceil($result);
>        return $val += $divide;
>       break;
>       case ($length_value > 100):
>        return 40;
>       break;
>       default:
>        return 7;
>       break;
>      }
>      return $val;
>     }
>     else
>     {
>      return 7; // default value
>     }
>    }
>   break;
> 
>   case 'INPUT_TYPE':
> 
>    foreach ($types as $key => $val)
>    {
>     (string) $val;
>     (string) $key;
> 
>     // SEARCH
>     $regex = "/" . strtolower($key) . "/i";
>     $found = preg_match($regex, $string);
> 
>     if ($found === false)
>     {
>      return 'text'; // default value
>     }
>     else
>     {
>      return $val;
>     }
>    }
>   break;
>  }
> 
> } // END function printByType()


--- End Message ---
--- Begin Message ---
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, 2010 at 1:19 PM, shiplu <shiplu....@gmail.com> wrote:

> 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 Steve Jobs the rest)
>

--- End Message ---
--- Begin Message ---
Dear All,

If the OS is Windows 2003 64Bit (IIS)...
So, which php package must download and how to config it for running
with IIS ?
Due to I don't quite the online manual:
http://www.php.net/manual/en/install.windows.iis.php
Which installation mode is suitable of it ?

Thanks !

Edward.

--- End Message ---
--- Begin Message ---
On Sun, 2010-01-03 at 15:10 +0800, Edward S.P. Leong wrote:

> Dear All,
> 
> If the OS is Windows 2003 64Bit (IIS)...
> So, which php package must download and how to config it for running
> with IIS ?
> Due to I don't quite the online manual:
> http://www.php.net/manual/en/install.windows.iis.php
> Which installation mode is suitable of it ?
> 
> Thanks !
> 
> Edward.
> 


Personally I'd go with a WAMP install instead. Apache is faster, less
resource intensive, and more secure than IIS. You also have the benefit
of all the Apache mods out there, like mod_rewrite, which I believe
you'd have to pay for on an IIS server. 

Thanks,
Ash
http://www.ashleysheridan.co.uk



--- End Message ---

Reply via email to