// create your custom key and IV value
  $key="0123456789abcdef";  // this is 16 bytes, or 128 bits
  $iv="abcdef0123456789";   // this needs to be 16 bytes long
  
  $data="This is my super secret encrypted string";
  
  // round up the string length to the nearest multiple of 16
  
  $len=intval((strlen($data)+1)/16)*16;
  // encrypt the data  
  
  $encrypted_data = aes_encrypt($data,$len,$key,$iv);
  
  // store encrypted data into a base64-encoded string for easy tranport
  $base64_encrypted = base64_encode($encrypted_data);
  
  print("Your encrypted data is: ".$base64_encrypted);
  
  // this will yield: 
  // fcPkxhW0UM4VIYB1CsbK/7wEBuC4WAwcO5tDBkcMXbfmf/gOHqdnrz5qHBRVY8Ls
  
  
  // base64 decode the string again
  
  $base64_decrypted = base64_decode($base64_encrypted);
  
  // we will calculated the length from the base64 string rather than the encrypted 
  // one as the strlen() function may not yield a valid result if the encrypted string 
  // has a zero in it.  As base64 is 6 bits and our data is 8, we just need to multiply 
  // the the length by 6/8 or 0.75 to get the base64-decoded size.
  
  $len = intval(strlen($base64_encrypted) * 0.75);
  
  // decryption  routine
  
  $plain_data = aes_decrypt(&$base64_decrypted,$len,$key,$iv);
  
  print("\r\nYour decrypted data is: ".$plain_data);
  
?>
The above example will output something similar to: