Results will appear here...
• Copyright© 2025 xPralak Designs - Joseph Downey
<div id="page">
<?php
include('includes/header.php');
$filename = "arraysprocess.php";
echo '<h1 class="page-heading">Arrays Example 3</h1>';
echo '<h2>Enter Values to Store in an Array</h2>';
echo '<div class="content-area">';
echo '<div class="content-left">';
echo '<form id="arrayForm" onsubmit="event.preventDefault(); processArray();">
<input type="text" name="values" placeholder="Enter values separated by a |" required>
<h3>Select Modifications:</h3>
<label><input type="checkbox" name="sort" value="1"> Sort Array</label>
<select name="sort_order">
<option value="asc">Ascending</option>
<option value="desc">Descending</option>
</select><br>
<label><input type="checkbox" name="reverse" value="1"> Reverse Array Order</label><br>
<label><input type="checkbox" name="unique" value="1"> Remove Duplicates</label><br>
<label><input type="checkbox" name="shuffle" value="1"> Shuffle Array</label><br>
<label><input type="checkbox" name="uppercase" value="1"> Convert to Uppercase</label><br>
<label><input type="checkbox" name="merge" value="1"> Merge with Extra Values</label><br>
<button type="submit">Process</button>
</form>';
echo '</div>';
echo '<div class="content-right"><h3>Results:</h3><pre>';
echo '<div id="result">Results will appear here...</div></pre></div></div>';
?>
<script>
function processArray() {
let formData = new FormData(document.getElementById("arrayForm"));
let xhr = new XMLHttpRequest();
xhr.open("POST", "arraysprocess.php", true);
xhr.onload = function () {
document.getElementById("result").innerHTML = this.responseText;
};
xhr.send(formData);
}
</script>
<?php include('includes/footer.php');
echo '<pre>';
highlight_file($filename);
echo '</pre>';
?>
</div>