-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuserList.php
More file actions
31 lines (30 loc) · 742 Bytes
/
userList.php
File metadata and controls
31 lines (30 loc) · 742 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<script>
var jsvar;
var userList = [];
function getUsers(){
<?php
$xmlU = simplexml_load_file('userDataBase.xml') or die("cant load xml");
foreach ($xmlU as $user) {
if(!(empty($user->lastName))){
echo "jsvar = new user('$user->firstName','$user->lastName','$user->ID','$user->email','$user->password','$user->admin');
userList.push(jsvar);";
}
}
?>
console.log(userList);
var inOrder = false;
while(!inOrder){
inOrder = true;
for(let i = 0; i < userList.length-1; i++)
{
if(userList[i].lastName > userList[i+1].lastName){
inOrder = false;
var temp = userList[i];
userList[i] = userList[i+1];
userList[i+1] = temp;
}
}
}
return userList;
}
</script>