Skip to content

Instantly share code, notes, and snippets.

@Charlie-Lucas
Created January 11, 2016 08:55
Show Gist options
  • Save Charlie-Lucas/c889d736fc713a8f15d5 to your computer and use it in GitHub Desktop.
Save Charlie-Lucas/c889d736fc713a8f15d5 to your computer and use it in GitHub Desktop.
<?php
public function redislize($data)
{
// Only serialize if it's not a string or a integer
if(!is_string($data) && !is_integer($data))
{
return urlencode(serialize($data));
}
// Encode string to escape wrong saves
return urlencode($data);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment