Simple Example :
$encrypted = mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $this->key, $input, MCRYPT_MODE_CBC, $iv);
$encrypted = openssl_encrypt($input, 'AES-128-CBC', $this->key, OPENSSL_RAW_DATA, $iv);
More Details
Click here
http://php.net/manual/en/function.mcrypt-encrypt.php
http://php.net/manual/en/function.openssl-encrypt.php