I'm currently using 2 different php pages with different values for the same variables. I use 'include' so I can throw in the specific values for the variable whenever I need to.
Is there a way I can use functions to create variables with specific values without using class?
1.php
<?php
$by = 'phpbuilder';
$char = 'abc';
?>
2.php
<?php
$by = 'google';
$char = '123';
?>
<?php
if ($variable == 'value') {
include('1.php');
} else {
include('2.php');
}
echo "This " . $char . "post was created by " . $by;
?>
I can change the variable and value under the if and else statement but I have a lot of pages I would need to add and edit to get this.