Hi! Could we please enable some services and cookies to improve your experience and our website?
Online Sandbox for SQL and PHP: Write, Run, Test, and Share SQL Queries and PHP Code
<?php
$first_name = "<script>alert();</script>";
$middle_name = 'Robert';
$last_name = 'Smith';
$username = 'testusername1';
$email = "testemail@mail.com";
$password = 'banana1';
// Here goes your string which is an array of the above variables...
$strings = array ($first_name, $middle_name, $last_name, $username, $email, $password);
// Here goes the trick :)
$strings = array_map('htmlspecialchars', $strings);
echo $first_name;