0

PHP Fatal error: Uncaught TypeError: Unsupported operand types: string + string in overview.php:33 Stack trace: #0 {main} thrown in C:\inetpub\wwwroot\praktijkopdrachttennis\overview.php on line 33

<?php
    include("includes/header.php");
    //Session

    $username = "Tennisser";
    $password = "Tryhard";


if ($_POST['username'] == $username && $_POST['password'] == $password)
    {
         session_start();
         $_SESSION['login'] = true;
    }
    //Foutieve inlog
    else
         {
             echo "<a href='inlogpage.php'>Foutieve inlog, probeer het opnieuw./a>";
         }
//Code voor login true
    if ($_SESSION['login'] == true)
        {
            $leden = array ('Tim', 'Jur', 'Alba');

            $beschikbaarheid = array (3/5, 7/10, 12/3);

            $dagdelen = array ('Middag', 'Ochtend', 'Nacht');

            $countedmembers = count($leden);

            for ($i = 0; $i <= $countedmembers ; $i++ )
            {
                echo "<tr>";
                echo "<td>" + $leden[$i] + "</td>";
                echo "<td>" + $beschikbaarheid[$i] + "</td>";
                echo "<td>" + $dagdelen[$i] + "</td>";
            }
        }

?>
  • 3
    Does this answer your question? [How can I combine two strings together in PHP?](https://stackoverflow.com/questions/8336858/how-can-i-combine-two-strings-together-in-php) – El_Vanja May 19 '21 at 15:34

1 Answers1

5

Just use dot . as concatenation operator not plus +

<?php
  
// First String
$a = 'Hello';
  
// Second String
$b = 'World!';
  
// Concatenation Of String
$c = $a.$b;
  
// print Concatenate String
echo " $c \n";
?>
Guru
  • 139
  • 3