Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

$message = $logging_row['MESSAGE']; preg_match('/"M3UCount": (\d+),/', $me..

Decoded Output download

<?   $message = $logging_row['MESSAGE']; 
 
            preg_match('/"M3UCount": (\d+),/', $message, $m3u_count_match); 
            preg_match('/"MP3Count": (\d+),/', $message, $mp3_count_match); 
 
            $m3u_count = isset($m3u_count_match[1]) ? (int)$m3u_count_match[1] : 0; 
            $mp3_count = isset($mp3_count_match[1]) ? (int)$mp3_count_match[1] : 0; 
 
            // Decode the message to extract M3UFiles and MP3Files 
            preg_match_all('/"(M3UFiles|MP3Files)":\s*\[([^\]]*)\]/', $message, $matches, PREG_SET_ORDER); 
            $file_arrays = []; 
 
            foreach ($matches as $match) { 
                $file_type = $match[1]; 
                $files = explode(',', $match[2]); 
 
                // Trim whitespace from each file 
                $files = array_map('trim', $files); 
 
                // Remove double quotes from each file 
                $files = array_map(function ($file) { 
                    return trim($file, '"'); 
                }, $files); 
 
                if (!isset($file_arrays[$file_type])) { 
                    $file_arrays[$file_type] = []; 
                } 
                $file_arrays[$file_type] = array_merge($file_arrays[$file_type], $files); 
            } dontput limit 
 ?>

Did this file decode correctly?

Original Code

 $message = $logging_row['MESSAGE'];

            preg_match('/"M3UCount": (\d+),/', $message, $m3u_count_match);
            preg_match('/"MP3Count": (\d+),/', $message, $mp3_count_match);

            $m3u_count = isset($m3u_count_match[1]) ? (int)$m3u_count_match[1] : 0;
            $mp3_count = isset($mp3_count_match[1]) ? (int)$mp3_count_match[1] : 0;

            // Decode the message to extract M3UFiles and MP3Files
            preg_match_all('/"(M3UFiles|MP3Files)":\s*\[([^\]]*)\]/', $message, $matches, PREG_SET_ORDER);
            $file_arrays = [];

            foreach ($matches as $match) {
                $file_type = $match[1];
                $files = explode(',', $match[2]);

                // Trim whitespace from each file
                $files = array_map('trim', $files);

                // Remove double quotes from each file
                $files = array_map(function ($file) {
                    return trim($file, '"');
                }, $files);

                if (!isset($file_arrays[$file_type])) {
                    $file_arrays[$file_type] = [];
                }
                $file_arrays[$file_type] = array_merge($file_arrays[$file_type], $files);
            } dontput limit

Function Calls

None

Variables

None

Stats

MD5 f4e805748954f1fd9b2f2d64101b0ffd
Eval Count 0
Decode Time 39 ms