1<?php
2 $myVariable = "a";
3 function changeVar($newVar) {
4 global $myVariable
5 $myVariable = "b";
6 }
7 echo $myVariable; // Should echo b
8?>
1<?php
2function setGlobalVariable() {
3 $GLOBALS['variable_name'] = "Some Value";
4}
5setGlobalVariable();
6echo $variable_name;
7// Outputs: Some Value
1
2<?php
3$search_html = filter_input(INPUT_GET, 'search', FILTER_SANITIZE_SPECIAL_CHARS);
4$search_url = filter_input(INPUT_GET, 'search', FILTER_SANITIZE_ENCODED);
5echo "Vous avez recherché $search_html.\n";
6echo "<a href='?search=$search_url'>Nouvelle recherche.</a>";
7?>
8
9