What would be the best way to do the following:
In a shoutbox, you type in "/ban Jack", whats the best way of checking if:
/ban is at the beginning of the string
So if someone types in "the command is /ban jack" it wont do anything?

What would be the best way to do the following:
In a shoutbox, you type in "/ban Jack", whats the best way of checking if:
/ban is at the beginning of the string
So if someone types in "the command is /ban jack" it wont do anything?
PHP Code:<?php
$string = '/ban lol';
if( preg_match( '/^\/ban (.*)$/i', $string, $match ) )
{
$username = $match[ 1 ];
echo $username;
}
?>
Want to hide these adverts? Register an account for free!