php - string to md5 hash in class using FILTER_SANITIZE_STRING -


question: why don't these match on output?

so have been tracking down issue causing me lot of headache can't figure out causing issues passing shortened version of md5 hash sanatized filter_sanitize_string

i know seems strange sanitize md5 hash class not used in manner , trying avoid making multiple methods same thing.

class test { public function select($match,$debug) {         $match1 = filter_var($match, filter_sanitize_string);         if ($debug == '1') {             var_dump($match,$match1);         }  } }  $title = "april 2013"; // example title $currenthuid = substr(md5($title), 0, 12); // convert string uid not encryption comparison first 12 char of md5 hash  $test = new test(); $test->select("'$currenthuid'",'1'); 

results: string(14) "'8860d4398c9b'" string(22) "'8860d4398c9b'"

you sending single quotes value , these encoded.

if use:

$match1 = filter_var($match, filter_sanitize_string, filter_flag_no_encode_quotes); 

the result same input.

example.

also see manual.


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -