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? 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. 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. 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! Link to comment https://forums.phpfreaks.com/topic/261354-preg_match-an-array/#findComment-1339411 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.