Display FNumber (aperture) as a number versus a fraction

Assuming it is appropriate to do so, you can change your code to this:

<dt>EXIF data:</dt>
<dd><ul>
<?php foreach ($exif as $key => $value): 
    if (($key != "Width") && ($key != "Height") && ($key !="DateTime")): ?><li><strong><?php
        if ($key == "model") { 
            echo "Camera"; 
        } elseif ($key == "ExposureTime") { 
            echo "Exposure"; 
            //$newvalue = explode("(", $value);
            //$newvalue = substr($newvalue[2], 0, -1)."s";
              $newvalue = $value . "s"; // see note 1
        } elseif ($key == "FNumber") {
            echo "Aperture";
            $fraction_parts = explode("https://wordpress.stackexchange.com/", $value);
            $newvalue = $fraction_parts[0] / $fraction_parts[1] // see note 2
        } else { 
            echo $key; 
        } ?></strong>: <?php if (!$newvalue) { echo $value; } else { echo $newvalue; $newvalue=""; } ?></li>
    <?php endif; 
endforeach; ?>
</ul></dd></dl>

I didn’t test it, so please let me know if it doesn’t work and i’ll fix it.

Note 1
it was only outputting the “s” for the shutter speed because the expode was trying to break the string apart based on ( but there was not a ( in the string. So, when the substr() function was looking at newvalue[2] it wasn’t getting anything. Also, you were probably getting a warning from PHP that an array key did not exist (you can check it in your PHP logs).

Since your data from the dump you provided looks like fine output already, I just appended “s” to it.

Note 2
To get the decimal value of the fraction I exploded it by “https://wordpress.stackexchange.com/” which made an array with the numerator as the first value and the denominator as the second value. Then, since $newvalue is set to print (instead of $value) if it exists, I set $newvalue to the result of dividing the numerator by the denominator.

I hope this helps.

Cheers!

Edit 1
To get it to show as “sec” instead of “s”, just change where the code says . "s" to say . "sec". Then, to get it to show “f/” in front of the focal number you can add "f/" . before fraction_parts[0]. Note how the period (.) is used to join strings.

Edit 2
About the additional request posted in the comment below, this is how you can edit other outputs from your $exif array:

<dt>EXIF data:</dt>
<dd><ul>
<?php foreach ($exif as $key => $value): 
    if (($key != "Width") && ($key != "Height") && ($key !="DateTime")): ?><li><strong><?php
        if ($key == "model") { 
            echo "Camera"; 
        } elseif ($key == "ExposureTime") { 
            echo "Exposure"; 
            //$newvalue = explode("(", $value);
            //$newvalue = substr($newvalue[2], 0, -1)."s";
              $newvalue = $value . "s"; // see note 1
        } elseif ($key == "FNumber") {
            echo "Aperture";
            $fraction_parts = explode("https://wordpress.stackexchange.com/", $value);
            $newvalue = $fraction_parts[0] / $fraction_parts[1] // see note 2
        } elseif ($key == "ExposureProgram") { // see note 3
            echo "Exposure Program";
            $value_definitions = array(
                '2' => "Auto",
                '3' => "Aperture Priority",
                '4' => "Shutter Priority"
            );
            if( array_key_exists( $value, $value_definitions ) ) {
                $newvalue = $value_definitions[$value];
            }
        } else { 
            echo $key; 
        } ?></strong>: <?php if (!$newvalue) { echo $value; } else { echo $newvalue; $newvalue=""; } ?></li>
    <?php endif; 
endforeach; ?>
</ul></dd></dl>

Note 3
This is a conditional that works just like the other ones. It sets the $newvalue variable which is used to replace the $value variable. However, this one will only set the $newvalue if the $value is one of the keys in the $value_definitions array. If $value matches a key in the $value_definitions array, $newvalue will be set to the value assigned to the matching key.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)