Advertisement
Guest User

Untitled

a guest
Dec 14th, 2017
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. 1.
  2. $sum = 0;
  3. for($i = 0; $i < count($arr); $++){
  4. $sum += $arr[$i];
  5. }
  6.  
  7. 2.
  8. $hostname = 'hostname';
  9. $username = 'username';
  10. $password = 'password';
  11. $dbName = 'dbName';
  12. $table = 'table';
  13. $delId = 'delId';
  14. $mysqli = new mysqli($hostname, $username, $password, $dbName);
  15. $mysqli->query('DELETE FROM '.$table.' WHERE id = "'.$delId.'"');
  16. $mysqli->close();
  17.  
  18. 3.
  19. $path = getcwd();
  20. $objects = scandir($path);
  21. foreach($objects as $file){
  22. $new_file = $path.'/'.$file;
  23. if(is_file($new_file)){
  24. echo $file.'<br>';
  25. }
  26. }
  27.  
  28. 4.
  29. $array = array(3, 1, 2, 4);
  30. sort($array);
  31. foreach($array as $elem){
  32. echo $elem.'<br>';
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement