domingo, 25 de junio de 2023

find if a word or substring exist based on php array

 <?php



$acctname = array(

    "Nash_paid",

    "Nash_Orange",

    "Sagi_Orange",

    "Sagu_paid",

    "Red_Phone",

    "Main_Paid",

    "Abi_Orange",

    "Abi_paid",

    "Repeated client_",

    "Meni_Road",

    "Meni_Towing",

    "Main_line");



$string="Red_Phone";

foreach($acctname as $substring){

if (stripos($string, $substring) !== false) {


echo  "$substring<br>";

}

}


?>

get the the monday and sunday from a week a go

 <?php

// Get the current date

$currentDate = date('Y-m-d');


// Calculate the previous week's Monday

$previousMonday = date('Y-m-d', strtotime($currentDate . ' -1 week monday'));


// Calculate the previous week's Sunday

$previousSunday = date('Y-m-d', strtotime($currentDate . ' -1 week sunday'));


// Display the results

echo "Previous Week's Monday: " . $previousMonday . "<br>";

echo "Previous Week's Sunday: " . $previousSunday . "<br>";

?>