Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Jan 2003
    Posts
    39
    Thanks
    0
    Thanked 4 Times in 4 Posts

    Question read/write file with multy line strings

    I'm trying write a script to translate language files online.
    my language files conteins text variables that I need to translate.
    $string['left'] = "Left";

    some of them are multi line:
    $string['error'] = "You are not logged in.
    Please login here or register.";


    and some of them have arrays:
    $sort['images'] = array(
    "ASC" => "Ascending",
    "DESC" => "Descending"
    );


    So, to read the files, I just do include("lang.php"); and then pull value of each variable, it was easy, but now I'm having problem (just dont have an idea how to) with write new values for each variable into the file...
    can someone give me an idea what is the best way to do so and/or how to?

    thx.
    V@no.

  • #2
    Regular Coder
    Join Date
    Sep 2002
    Location
    British Columbia
    Posts
    235
    Thanks
    0
    Thanked 0 Times in 0 Posts
    var_export() will dump the contents of a variable as valid PHP code

    http://www.php.net/manual/en/function.var-export.php


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •