Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if (isset($_GET['commands'])&&isset($_GET['delimiter'])){
- $command= $_GET['commands'];
- $delimiter = $_GET['delimiter'];
- $command = explode("\n", $command);
- $command = array_map('trim', $command);
- $result=[];
- for($i=0; $i<sizeof($command); $i++){
- $parts = explode($delimiter, $command[$i]);
- if($parts[0] == "add"){
- $result[$i] = $parts[1];
- }
- else if($parts[0]== "remove"){
- array_splice($result,$parts[1],1);
- }
- }
- for($i=0; $i<sizeof($result); $i++){
- echo $result[$i]."<br>";
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement