I need some help from you guys to make this work. I need to combine 2 php codes to work together. I am a beginner in php, I appreciate to the maximum every advice received from you. Thank you in advance!
Description: I want to display content from 8 pages (some text) and display the taken content in random order in my index.php I don't know how to select start line from which to retrieving the text data from the pages, that's why I picked the character option (starts after 1305 characters and count 375 characters).
Code 1 (pick 8 pages and show them in random order)
<?php
$files = [
"folder/content1.php",
"folder/content2.php",
"folder/content3.php",
"folder/content4.php",
"folder/content5.php",
"folder/content6.php",
"folder/content7.php",
"folder/content8.php"
];
shuffle($files);
foreach ($files as $key => $file) { require($file); }
?>
Code 2 (take content from page after count 1305 CHARACTERS and show only 375 CHARACTERS)
<?php $section1 = file_get_contents("folder/content1.php", FALSE, NULL, 1305, 375); echo $section1; ?> </p>
<?php $section2 = file_get_contents("folder/content2.php", FALSE, NULL, 1305, 375); echo $section3; ?> </p>
<?php $section3 = file_get_contents("folder/content3.php", FALSE, NULL, 1305, 375); echo $section3; ?> </p>
<?php $section4 = file_get_contents("folder/content4.php", FALSE, NULL, 1305, 375); echo $section4; ?> </p>
<?php $section5 = file_get_contents("folder/content5.php", FALSE, NULL, 1305, 375); echo $section5; ?> </p>
<?php $section6 = file_get_contents("folder/content6.php", FALSE, NULL, 1305, 375); echo $section6; ?> </p>
<?php $section7 = file_get_contents("folder/content7.php", FALSE, NULL, 1305, 375); echo $section7; ?> </p>
<?php $section8 = file_get_contents("folder/content8.php", FALSE, NULL, 1305, 375); echo $section8; ?> </p>
My combined codes are not working
<?php
$files = [
"folder/content1.php",
"folder/content2.php",
"folder/content3.php",
"folder/content4.php",
"folder/content5.php",
"folder/content6.php",
"folder/content7.php",
"folder/content8.php"
];
shuffle($files);
foreach ($files as $key => $file) file_get_contents("$files", FALSE, NULL, 1305, 375); { require($file); }
?>