Folks,
Q1. A function parameter that takes in a constant, can it always take in a variable, unless it needs a handle ?
While going through the Explode function tutorial, I did not come across anything that states the 3rd parameter (explode limit) in the Explode function has to be a string or a constant. Like so:
<?php
//Tutorial: http://www.tizag.com/phpT/php-string-explode.php
echo "Script 1"; //Using a Constant as 3rd parameter in the Explode function. Using FOR function.
$phrase = "Please don't blow me to pieces.";
$words = explode(" ", $phrase);
print_r($words);
for($i = 0; $i < count($words); $i++){
echo "Piece $i = $words[$i] <br />";
}
$explode_limit = 4;
$words = explode(" ", $phrase, 4);
for($i = 0; $i < count($words); $i++){
echo "Limited Piece $i = $words[$i] <br />";
}
print_r ($words);
?>