public function encrypt($data)
    {
        if ($this->iv === null) {
            $dataEncrypted = mcrypt_encrypt($this->cipher, $this->key, $data, $this->mode);
        } else {
            $dataEncrypted = mcrypt_encrypt($this->cipher, $this->key, $data, $this->mode, $this->iv);
        }

        return bin2hex($dataEncrypted);
    }
public function encrypt($data)
    {
        if ($this->iv === null) {
            $dataEncrypted = mcrypt_encrypt($this->cipher, $this->key, $data, $this->mode);
        } else {
            $dataEncrypted = mcrypt_encrypt($this->cipher, $this->key, $data, $this->mode, $this->iv);
        }

        return bin2hex($dataEncrypted);
    }
public function encrypt ( $ data ) { if ( $ this -> iv === null ) { $ dataEncrypted = mcrypt_encrypt ( $ this -> cipher , $ this -> key , $ data , $ this -> mode ) ; } else { $ dataEncrypted = mcrypt_encrypt ( $ this -> cipher , $ this -> key , $ data , $ this -> mode , $ this -> iv ) ; } return bin2hex ( $ dataEncrypted ) ; }
Encrypt the data string

@param  string $data
@return string
Encrypt the data string