Skip to content
View in the app

A better way to browse. Learn more.

GTAGames.nl - De Nederlandse Grand Theft Auto Community!

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

[PHP TUT] functies

Goed ik ga er vanuit dat jullie al de basis kunnen.

Basis:

Php bestaat voornamelijk uit functies. Deze gebruik je als volgd:

<?php
functienaam(parameters);
?>

Paar voorbeelden:

<?php
echo time(); // Geeft het aantal seconden verstreken sinds 1970
echo date("d-m-y"); // Geeft de datum in de parameter kan je tekst zetten d word veranderd in de dag, m word veranderd in de maand en y word veranderd in het jaar
je kan ook het volgende doen:
$timestamp = time();
echo date("d-m-y", $timestamp); // Dit geeft het zelfde terug als de eerste keer dat ik de functie date() aanroep omdate de timestamp van nu is
$tekst = "	Dit is de tekst waarmee ik een aantal functies ga uitleggen!	";
$new_tekst = trim($tekst);  // Trim verwijdert de spaties die voor de tekst en achter de tekst staat
?>

Er zijn nog vele meer functies maar die ga ik nu niet allemaal uitlegen.

Zelf een functie maken:

Ja dit kan je ook doen met php.

<?php
function functienaam()
{
	// hier zet je dan al de shit van je functie
	// echo'en enz kan je gewoon doen maar ik gebruik liever return
	// return geeft een waarde aan de functie en die kan je dan echo'en dus bv.
	return "Dit is de output van de functie";
}

echo functienaam();  // Dit toont: Dit is de output van de functie
?>

In een functie kan je geen variabelen van buiten de functie gebruiken, maar als je dit wel wilt doen moet je gewoon het volgende stukje code in de tekst zetten:

global $variabele;

Zo dit was het, ik hoop dat jullie wat hebben bijgeleerd!

Edit: dit is men 123ste post

Copyright Juuldr

Edited by juuldr

Featured Replies

Simpele maar goede tutorial.

>>> Door Jarno: In Master Tutorial List gezet!<<<

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.