Advertisement
Guest User

Untitled

a guest
Nov 26th, 2014
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. <?php
  2.  
  3. function select_all($path)
  4. {
  5. $file = file_get_contents($path.".json");
  6. $dec = json_decode($file);
  7. return($dec);
  8. }
  9. select_all("users");
  10.  
  11. function new_tab($path, $new_content)
  12. {
  13. $old = select_all($path) ;
  14. array_push($old, $new_content);
  15. $new = json_encode($old);
  16. file_put_contents($path.".json", $new);
  17. var_dump($old);
  18. }
  19. new_tab("users", "hello");
  20.  
  21. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement