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

Signing you up...

Thank you for signing up!

PHP Decode

<!DOCTYPE html> <html> <head> <title>Letter Count Detailed</title> <!-- Bootst..

Decoded Output download

<!DOCTYPE html> 
<html> 
<head> 
    <title>Letter Count Detailed</title> 
    <!-- Bootstrap CSS --> 
    <link href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet"> 
</head> 
<body> 
 
<div class="container"> 
    <h2>Count Letters in Text</h2> 
 
    <!-- Form --> 
    <form method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>"> 
        <div class="form-group"> 
            <label for="userText">Enter Text:</label> 
            <textarea class="form-control" id="userText" name="userText" rows="3"></textarea> 
        </div> 
        <button type="submit" class="btn btn-primary">Submit</button> 
    </form> 
 
    <?php 
    if ($_SERVER["REQUEST_METHOD"] == "POST") { 
        $text = strtolower($_POST["userText"]); // Convert to lowercase 
        $letters = range('a', 'z'); 
        $letterCount = array_fill_keys($letters, 0); 
        $totalLetters = 0; 
 
        // Count each letter 
        foreach (str_split($text) as $char) { 
            if (array_key_exists($char, $letterCount)) { 
                $letterCount[$char]++; 
                $totalLetters++; 
            } 
        } 
 
        // Display results in a table 
        echo "<table class='table mt-3'>"; 
        echo "<thead><tr><th>Letter</th><th>Count</th></tr></thead><tbody>"; 
        foreach ($letterCount as $letter => $count) { 
            echo "<tr><td>" . strtoupper($letter) . "</td><td>" . $count . "</td></tr>"; 
        } 
        echo "<tr><td><strong>Total Letters</strong></td><td><strong>$totalLetters</strong></td></tr>"; 
        echo "</tbody></table>"; 
    } 
    ?> 
</div> 
 
</body> 
</html>

Did this file decode correctly?

Original Code

<!DOCTYPE html>
<html>
<head>
    <title>Letter Count Detailed</title>
    <!-- Bootstrap CSS -->
    <link href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>

<div class="container">
    <h2>Count Letters in Text</h2>

    <!-- Form -->
    <form method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>">
        <div class="form-group">
            <label for="userText">Enter Text:</label>
            <textarea class="form-control" id="userText" name="userText" rows="3"></textarea>
        </div>
        <button type="submit" class="btn btn-primary">Submit</button>
    </form>

    <?php
    if ($_SERVER["REQUEST_METHOD"] == "POST") {
        $text = strtolower($_POST["userText"]); // Convert to lowercase
        $letters = range('a', 'z');
        $letterCount = array_fill_keys($letters, 0);
        $totalLetters = 0;

        // Count each letter
        foreach (str_split($text) as $char) {
            if (array_key_exists($char, $letterCount)) {
                $letterCount[$char]++;
                $totalLetters++;
            }
        }

        // Display results in a table
        echo "<table class='table mt-3'>";
        echo "<thead><tr><th>Letter</th><th>Count</th></tr></thead><tbody>";
        foreach ($letterCount as $letter => $count) {
            echo "<tr><td>" . strtoupper($letter) . "</td><td>" . $count . "</td></tr>";
        }
        echo "<tr><td><strong>Total Letters</strong></td><td><strong>$totalLetters</strong></td></tr>";
        echo "</tbody></table>";
    }
    ?>
</div>

</body>
</html>

Function Calls

htmlspecialchars 1

Variables

None

Stats

MD5 40fe28ad0bea5ba579f3d8ba04508caf
Eval Count 0
Decode Time 59 ms