Re: Re: Help with matching numbers 0-100

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



frank wrote:
> better make a switch statement: with case such as
> switch($x):

that should be :

switch (true) {
	// bla
}

otherwise you would be testing the boolean cast of the
value of $x against the result of the expression given in
the case statement ... in practice it would probably
do what you want but not for the reason you think.

> case ($x >= 16 && $x <= 30):
> 
>     break;
> case ....
> 
> set*
> 
> 
> ""Chilling Lounge Admin"" <admin@xxxxxxxxxxxxxxxxxx> schrieb im Newsbeitrag
> news:a927b2380702030855w1d730547wcb35d813c8b09a4b@xxxxxxxxxxxxxxxxx
>> Hi.
>>
>> I need help with matching a variable. The variable would be e.g. 0-15
>> , 16-30 etc. and when the variable is equal to a certain range, it
>> would echo an image.
>>
>> Does anyone know what function I should use? preg_match?
>>
>> The code would be something like
>>
>> if(preg_match("[16-30]",$variable))
>> {
>> echo "image";
>> }
>>
>> but the above code doesn't work. How do I fix it?
>>
>> Thanx
> 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux