strategos Posted April 21, 2012 Share Posted April 21, 2012 Hello, I am a bit confused on the preg_match subject. here is a snippet where I use the preg_match func: <?php foreach ($bans as $ban){ $curbans = $ban["user_steamid"]; if(isset($_POST['submit2'])) { $_SESSION['isbanned'] = preg_match('/'.$_SESSION['inputid'].'/i', $curbans) } }; ?> The array, $curbans, looks like this STEAM_0:1:25941882STEAM_0:1:37863673STEAM_0:0:49096012STEAM_0:0:31113930 How would I get it to match something like "STEAM_0:0:49096012" with a value in the array? Quote Link to comment https://forums.phpfreaks.com/topic/261354-preg_match-an-array/ Share on other sites More sharing options...
trq Posted April 21, 2012 Share Posted April 21, 2012 The second argument to preg_match needs to be a string. Quote Link to comment https://forums.phpfreaks.com/topic/261354-preg_match-an-array/#findComment-1339264 Share on other sites More sharing options...
strategos Posted April 21, 2012 Author Share Posted April 21, 2012 Ok, how would I convert that into a string? I tried using implode('', $curbans); All I get is an error. Quote Link to comment https://forums.phpfreaks.com/topic/261354-preg_match-an-array/#findComment-1339377 Share on other sites More sharing options...
MMDE Posted April 21, 2012 Share Posted April 21, 2012 Ok, how would I convert that into a string? I tried using implode('', $curbans); All I get is an error. What exactly is it you want to achieve? By the looks of your code it doesn't seem to do what I think you want to do at all. Tell us, and we will help you! Quote Link to comment https://forums.phpfreaks.com/topic/261354-preg_match-an-array/#findComment-1339411 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.