Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Metode 1
- <?php
- class profile() {
- var $username;
- var $andenVariabel;
- function setData($a,$b) {
- $username = $a;
- $andenVariabel = $b;
- }
- }
- $profil = new profile();
- $profil->setData("brugernavn","blabla");
- echo $profil->username;
- echo $profil->andenVariabel;
- ?>
- Metode 2 (min favorit)
- <?php
- class profile() {
- var $username;
- var $andenVariabel;
- function fetchUser($username) {
- // NOGET DB STUFF DER HENTER BRUGEREN
- $user = mysql.........;
- $username = $user["username"];
- $andenVariabel = $user["name"];
- }
- function displayProfile() {
- echo $this->username;
- echo $this->andenVariabel;
- }
- }
- $profil = new profile();
- $profil->fetchUser("brugernavn");
- $profil->displayProfile();
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement