Jump to content

PHP editing another PHP file.


frankm

Recommended Posts

Hi. me and my friends are working on a text based rpg game. what i need is to have PHP to go and edit a file that contains a huge PHP file like below

 

Example:

<?php
$color1 = red;
$color2 = blue;
$color3 = green;
?>

 

Pages like these are going to be included in other files to set variables. But as the player advances through the game these variables will change. I need a PHP to get this file, find a specific variable, such as $color2, and edit it.

 

For example, if i have $money = 100; in that file and the player earns $10, I need PHP to find $money and add 10 to it.

How can I do this.

Also, the game is in early development and I will plan on using SQL. But not now...

 

Thank You!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.