Quellcode Editor

Ausgabe:

<?php /* * Copyright (c) 2021. BitDEVil2K16 Club. All rights reserved. * @author BitDEVil2K16 (Sascha P.) * @author BitDEVil2K16 Club * @author BitDEVil2K16 Club https://bitdevil2k16.club * @github https://github.com/BitDEVil2K16 * @FileName: uint2bit.php * */ if (!function_exists('convertuinttobits')) { /** * @param $flag * @return array */ function convertuinttobits($flag): array { $flags= array(); // Array initialisieren for ($i = 0; $i <= 32; $i++) { if ($flag & (1 << $i)) { $flags[] = (1 << $i); } } sort($flags); // Kurz mal das Array sortieren 1,2,3,4..... return $flags; // zurück geben } } foreach (convertuinttobits(1572865) as $flag){ echo "Das Flag: $flag<br />"; }