method jsonBase64Decode documentation in bbn\X

Decodes the base64 array's values. You can also give a JSON string of an array.

Example

X::jsonBase64Decode(['a' => 'SGVsbG8gV29ybGQh', 'b' => ['c' => base64_encode('Rm9v')]]); // (array) ['a' => 'Hello World!', 'b' => ['c' => 'Foo']] X::jsonBase64Decode('{"a":"SGVsbG8gV29ybGQh","b":{"c":"Rm9v"}}'); // (array) ['a' => 'Hello World!', 'b' => ['c' => 'Foo']] function($st) { $res = \is_string($st) ? json_decode($st, true) : $st; if (\is_array($res)) { foreach ($res as $i => $a) { if (\is_array($a)) { $res[$i] = self::jsonBase64Decode($a); } elseif (\is_string($a)) { $res[$i] = base64_decode($a); } else{ $res[$i] = $a; } } return $res; } return null; }

Decodes the base64 array's values. You can also give a JSON string of an array. BBN is a suite of PHP and JS libraries and VueJS components - all open-source! bbn.io, build applications, the quick way

This website uses cookies to ensure you get the best experience on our website.