Jump to content

[SOLVED] PHP Function


killah

Recommended Posts

Is there any php function that i can use to check if a number is in a string?

 

I have this code

 

$errno = array($soc['oUPGRADES']);
if( in_array($soc['upID'], $errno[0]) )
{
echo '
<option value="null">'.$soc['upNAME'].' (Already Bought)</option>';
}

 

but it does not seem to work

 

I am trying to do something like this in other word's.

 

if( 1 is in (9,7,1,8) )

{

  //already bought

}

 

Any help would be appreciated.

Link to comment
https://forums.phpfreaks.com/topic/143553-solved-php-function/
Share on other sites

By the sounds of thins he's going to be checking if the id number of a product is in an array so will already have the number to check against, if there are a few products it would still be faster to do this using strpos()

 

And I think you're looking for /\d*/

Link to comment
https://forums.phpfreaks.com/topic/143553-solved-php-function/#findComment-753165
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.