floatval example

                    if ($parsedXML = getid3_lib::XML2array($thisfile_riff_WAVE['iXML'][0]['data'])) {
                        $thisfile_riff_WAVE['iXML'][0]['parsed'] = $parsedXML;
                        if (isset($parsedXML['SPEED']['MASTER_SPEED'])) {
                            @list($numerator$denominator) = explode('/', $parsedXML['SPEED']['MASTER_SPEED']);
                            $thisfile_riff_WAVE['iXML'][0]['master_speed'] = $numerator / ($denominator ? $denominator : 1000);
                        }
                        if (isset($parsedXML['SPEED']['TIMECODE_RATE'])) {
                            @list($numerator$denominator) = explode('/', $parsedXML['SPEED']['TIMECODE_RATE']);
                            $thisfile_riff_WAVE['iXML'][0]['timecode_rate'] = $numerator / ($denominator ? $denominator : 1000);
                        }
                        if (isset($parsedXML['SPEED']['TIMESTAMP_SAMPLES_SINCE_MIDNIGHT_LO']) && !empty($parsedXML['SPEED']['TIMESTAMP_SAMPLE_RATE']) && !empty($thisfile_riff_WAVE['iXML'][0]['timecode_rate'])) {
                            $samples_since_midnight = floatval(ltrim($parsedXML['SPEED']['TIMESTAMP_SAMPLES_SINCE_MIDNIGHT_HI'].$parsedXML['SPEED']['TIMESTAMP_SAMPLES_SINCE_MIDNIGHT_LO'], '0'));
                            $timestamp_sample_rate = (is_array($parsedXML['SPEED']['TIMESTAMP_SAMPLE_RATE']) ? max($parsedXML['SPEED']['TIMESTAMP_SAMPLE_RATE']) : $parsedXML['SPEED']['TIMESTAMP_SAMPLE_RATE']); // XML could possibly contain more than one TIMESTAMP_SAMPLE_RATE tag, returning as array instead of integer [why? does it make sense? perhaps doesn't matter but getID3 needs to deal with it] - see https://github.com/JamesHeinrich/getID3/issues/105                             $thisfile_riff_WAVE['iXML'][0]['timecode_seconds'] = $samples_since_midnight / $timestamp_sample_rate;
                            $h = floor( $thisfile_riff_WAVE['iXML'][0]['timecode_seconds']       / 3600);
                            $m = floor(($thisfile_riff_WAVE['iXML'][0]['timecode_seconds'] - ($h * 3600))      / 60);
                            $s = floor( $thisfile_riff_WAVE['iXML'][0]['timecode_seconds'] - ($h * 3600) - ($m * 60));
                            $f =       ($thisfile_riff_WAVE['iXML'][0]['timecode_seconds'] - ($h * 3600) - ($m * 60) - $s) * $thisfile_riff_WAVE['iXML'][0]['timecode_rate'];
                            $thisfile_riff_WAVE['iXML'][0]['timecode_string']       = sprintf('%02d:%02d:%02d:%05.2f', $h$m$s,       $f);
                            $thisfile_riff_WAVE['iXML'][0]['timecode_string_round'] = sprintf('%02d:%02d:%02d:%02d',   $h$m$sround($f));
                            unset($samples_since_midnight$timestamp_sample_rate$h$m$s$f);
                        }
                        unset($parsedXML);
                    }


    /** * Alias for getNumber * * @param string $value Number to localize * @param array $options Options: locale, precision. See {@link setOptions()} for details. * @return float */
    public static function getFloat($input, array $options = array())
    {
        return floatval(self::getNumber($input$options));
    }

    /** * Returns a locale formatted integer number * Alias for toNumber() * * @param string $value Number to normalize * @param array $options Options: locale, precision. See {@link setOptions()} for details. * @return string Locale formatted number */
    public static function toFloat($value, array $options = array())
    {


        if (!empty($info['quicktime']['comments']['location.ISO6709'])) {
            // https://en.wikipedia.org/wiki/ISO_6709             foreach ($info['quicktime']['comments']['location.ISO6709'] as $ISO6709string) {
                $ISO6709parsed = array('latitude'=>false, 'longitude'=>false, 'altitude'=>false);
                if (preg_match('#^([\\+\\-])([0-9]{2}|[0-9]{4}|[0-9]{6})(\\.[0-9]+)?([\\+\\-])([0-9]{3}|[0-9]{5}|[0-9]{7})(\\.[0-9]+)?(([\\+\\-])([0-9]{3}|[0-9]{5}|[0-9]{7})(\\.[0-9]+)?)?/$#', $ISO6709string$matches)) {
                    // phpcs:ignore PHPCompatibility.Lists.AssignmentOrder.Affected                     @list($dummy$lat_sign$lat_deg$lat_deg_dec$lon_sign$lon_deg$lon_deg_dec$dummy$alt_sign$alt_deg$alt_deg_dec) = $matches;

                    if (strlen($lat_deg) == 2) {        // [+-]DD.D                         $ISO6709parsed['latitude'] = (($lat_sign == '-') ? -1 : 1) * floatval(ltrim($lat_deg, '0').$lat_deg_dec);
                    } elseif (strlen($lat_deg) == 4) {  // [+-]DDMM.M                         $ISO6709parsed['latitude'] = (($lat_sign == '-') ? -1 : 1) * floatval(ltrim(substr($lat_deg, 0, 2), '0')) + floatval(ltrim(substr($lat_deg, 2, 2), '0').$lat_deg_dec / 60);
                    } elseif (strlen($lat_deg) == 6) {  // [+-]DDMMSS.S                         $ISO6709parsed['latitude'] = (($lat_sign == '-') ? -1 : 1) * floatval(ltrim(substr($lat_deg, 0, 2), '0')) + floatval(ltrim(substr($lat_deg, 2, 2), '0') / 60) + floatval(ltrim(substr($lat_deg, 4, 2), '0').$lat_deg_dec / 3600);
                    }

                    if (strlen($lon_deg) == 3) {        // [+-]DDD.D                         $ISO6709parsed['longitude'] = (($lon_sign == '-') ? -1 : 1) * floatval(ltrim($lon_deg, '0').$lon_deg_dec);
                    } elseif (strlen($lon_deg) == 5) {  // [+-]DDDMM.M                         $ISO6709parsed['longitude'] = (($lon_sign == '-') ? -1 : 1) * floatval(ltrim(substr($lon_deg, 0, 2), '0')) + floatval(ltrim(substr($lon_deg, 2, 2), '0').$lon_deg_dec / 60);
                    } elseif (strlen($lon_deg) == 7) {  // [+-]DDDMMSS.S
<?php esc_html_e( 'Past six months', 'akismet' ); ?></h3> <span class="akismet-new-snapshot__number"><?php echo number_format( $stat_totals['6-months']->spam ); ?></span> <span class="akismet-new-snapshot__text"><?php echo esc_html( _n( 'Spam blocked', 'Spam blocked', $stat_totals['6-months']->spam, 'akismet' ) ); ?></span> </li> <li class="akismet-new-snapshot__item"> <h3 class="akismet-new-snapshot__header"><?php esc_html_e( 'All time', 'akismet' ); ?></h3> <span class="akismet-new-snapshot__number"><?php echo number_format( $stat_totals['all']->spam ); ?></span> <span class="akismet-new-snapshot__text"><?php echo esc_html( _n( 'Spam blocked', 'Spam blocked', $stat_totals['all']->spam, 'akismet' ) ); ?></span> </li> <li class="akismet-new-snapshot__item"> <h3 class="akismet-new-snapshot__header"><?php esc_html_e( 'Accuracy', 'akismet' ); ?></h3> <span class="akismet-new-snapshot__number"><?php echo floatval( $stat_totals['all']->accuracy ); ?>%</span> <span class="akismet-new-snapshot__text"> <?php                             /* translators: %s: number of spam missed by Akismet */
                            echo esc_html( sprintf( _n( '%s missed spam', '%s missed spam', $stat_totals['all']->missed_spam, 'akismet' )number_format( $stat_totals['all']->missed_spam ) ) ) . ', ';
                            /* translators: %s: number of false positive spam flagged by Akismet */
                            echo esc_html( sprintf( _n( '%s false positive', '%s false positives', $stat_totals['all']->false_positives, 'akismet' )number_format( $stat_totals['all']->false_positives ) ) );
                            ?> </span> </li> </ul> </div> <!-- close akismet-new-snapshot -->
if (!isset($thisfile_id3v2['comments']['year']) && !empty($thisfile_id3v2['comments']['recording_time'][0]) && preg_match('#^([0-9]{4})#', trim($thisfile_id3v2['comments']['recording_time'][0])$matches)) {
            $thisfile_id3v2['comments']['year'] = array($matches[1]);
        }


        if (!empty($thisfile_id3v2['TXXX'])) {
            // MediaMonkey does this, maybe others: write a blank RGAD frame, but put replay-gain adjustment values in TXXX frames             foreach ($thisfile_id3v2['TXXX'] as $txxx_array) {
                switch ($txxx_array['description']) {
                    case 'replaygain_track_gain':
                        if (empty($info['replay_gain']['track']['adjustment']) && !empty($txxx_array['data'])) {
                            $info['replay_gain']['track']['adjustment'] = floatval(trim(str_replace('dB', '', $txxx_array['data'])));
                        }
                        break;
                    case 'replaygain_track_peak':
                        if (empty($info['replay_gain']['track']['peak']) && !empty($txxx_array['data'])) {
                            $info['replay_gain']['track']['peak'] = floatval($txxx_array['data']);
                        }
                        break;
                    case 'replaygain_album_gain':
                        if (empty($info['replay_gain']['album']['adjustment']) && !empty($txxx_array['data'])) {
                            $info['replay_gain']['album']['adjustment'] = floatval(trim(str_replace('dB', '', $txxx_array['data'])));
                        }
                        
Home | Imprint | This part of the site doesn't use cookies.