FriendsNews header

search


Remove Duplicate Lines

by bill - 2025-03-08 04:42:33 ( in education, tech, computers, software) [php version] rebuild

I created this because I needed it regularly, and thought I'd share. Click here to run it, and look below to make one for yourself:


<!DOCTYPE html>

<html lang="en"><head><meta charset="UTF-8"><title>Remove Duplicate Lines</title></head>

<body><h2>Remove Duplicate Lines</h2>

<form method="post" action="">

<textarea name="inputText" rows="10" cols="50" placeholder="Paste your text here..."></textarea><br><br> <button type="submit" name="submit">Remove Duplicates</button>

</form>

<?php

if (isset($_POST['submit'])) {

$inputText = $_POST['inputText'];

$lines = explode("\n", $inputText); // Split the input into lines

$uniqueLines = array_unique($lines); // Remove duplicates

$resultText = implode("\n", $uniqueLines); // Join lines back together

echo "<h3>Result:</h3>";

echo "<textarea rows='10' cols='50'>" . htmlspecialchars($resultText) . "</textarea>";

}

?>

</body></html>


similar posts here ... and elsewhere

Comments (We enjoy free speech. Try not to offend, but feel free to be offended.)

Leave your own comment:

edit || rebuild || update || hide || set image

 

You might also like: dievna.com | hepya.com | holmesfamily.news | lazypugcafe.com | tarasfaves.com | williamarthurholmes.com | william's newsletter