how to split values in php

Viewed 28

datas.txt

$color =123;
$paint =232;

index.php

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title>HTML</title>
    </head>
    <body>
        <h1>HTML</h1>
        <p>HTML is a markup language for creating web pages.</p>
        <?php 
            $filename= "datas.txt";
            $fp= fopen($filename, "r" );            
                if($fp == true){
                    echo"hello";
                }
            $filesize= filesize($filename);
            $filetext= fread($fp, $filesize);
            
           
            //explode the array
            $filetext= explode("=",$filetext);
            
            print_r($filetext);
            
           
                

            ?>
    </body>

</html>

right now i am using this method to get value but the output is

Array ( [0] => $color [1] => 123; $color [2] => 2323; )

i want to assign the values later to variables

0 Answers
Related