Classes (PHP): verschil tussen versies

Uit De Vliegende Brigade
Naar navigatie springen Naar zoeken springen
Regel 33: Regel 33:
 
echo $a -> foo."\n";
 
echo $a -> foo."\n";
 
</pre>
 
</pre>
 +
 +
== Zie ook ==
 +
 +
* [[Arrays (PHP)]]
  
 
== Bronnen ==
 
== Bronnen ==
  
 
* https://www.php.net/manual/en/language.oop5.references.php
 
* https://www.php.net/manual/en/language.oop5.references.php

Versie van 23 apr 2019 12:39

Voorbeeld

<?php
#
###################################################################
#
# Define class "A"
##################
#
class A
{
	# Declare proptery & assign value
	##################################
	#
	public $foo = 1;
}

# Instantiate object class A
############################
#
$a = new A;

# Print propery $foo
####################
#
echo $a -> foo."\n";

# Manipulate $foo
####################
#
$a->foo = 12;
echo $a -> foo."\n";

Zie ook

Bronnen