473,398 Members | 2,188 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

Change 1 line in a php file

170 100+
I have a php file which looks like this:

<?php
$subjectshort='vetcm';
$comparray=array('c1','c2','e1');
?>

I need to change the $comparray line so it now looks like this:

$comparray=array('c1','c2','e1','e2');

How can I do this (I would appreciate actual code if possible).

Thankyou.
Nov 27 '07 #1
4 1512
MarkoKlacar
296 Expert 100+
I have a php file which looks like this:

<?php
$subjectshort='vetcm';
$comparray=array('c1','c2','e1');
?>

I need to change the $comparray line so it now looks like this:

$comparray=array('c1','c2','e1','e2');

How can I do this (I would appreciate actual code if possible).

Thankyou.
Hi,

you mean you want to add values to the array dynamically?
Nov 27 '07 #2
beary
170 100+
Hi,

you mean you want to add values to the array dynamically?
Thanks for your reply.

Um, well, yes I need this to happen via a script. The 'e1','e2' etc represent competencies, and when a user adds a competency, it needs to update this file. This file contains all the short abbreviations, and pretty much every other file in the system accesses this file to work.

Now obviously I myself can easily and quickly change this file manually, but the system is designed to be used by anyone without accessing the files directly on the server. Thus the need for the script to do it automatically.
Nov 27 '07 #3
gregerly
192 Expert 100+
Thanks for your reply.

Um, well, yes I need this to happen via a script. The 'e1','e2' etc represent competencies, and when a user adds a competency, it needs to update this file. This file contains all the short abbreviations, and pretty much every other file in the system accesses this file to work.

Now obviously I myself can easily and quickly change this file manually, but the system is designed to be used by anyone without accessing the files directly on the server. Thus the need for the script to do it automatically.
Personally, I'm thinking this is something that would be well suited for a database. Store the competencies in the DB, and pull them into your file dynamically, rather than actually writing to the file. Just a personal thing, you can probably get it to work either way, but the database option would be alot easier.

Greg
Nov 28 '07 #4
beary
170 100+
Personally, I'm thinking this is something that would be well suited for a database. Store the competencies in the DB, and pull them into your file dynamically, rather than actually writing to the file. Just a personal thing, you can probably get it to work either way, but the database option would be alot easier.

Greg
Gregerly, Thanks for your tip. You're probably right, it probably is suited for a db. But it's a 1 off thing, and I'm still wondering whether anybody out there can tell me the required code. I didn't think it would be too complicated. Perhaps I'm wrong...
Nov 29 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Mike Barnard | last post by:
Hi all, newbie here. Odd sounding subject but I can't describe it any better. I'm trying to teach myself a little about CSS. In a test site (not published) I am trying to use CSS to make...
2
by: Daniel Lidström | last post by:
Hi, I would like to know the cleanest way to change the serialization of my Line class from: <Line staStart="2327.02" length="10.00000003390744"> <End>549016.570965 57945.741122</End>...
3
by: Don Pasquale | last post by:
The following function intends to delete "numberoflines" lines from a text file, named "s" (string pointer) and pointed to by file pointer "fp", starting from line "line". Now, the function...
13
by: sonald | last post by:
Hi, Can anybody tell me how to change the text delimiter in FastCSV Parser ? By default the text delimiter is double quotes(") I want to change it to anything else... say a pipe (|).. can anyone...
3
by: W C Hull | last post by:
We have a request from Auditing to modify the password an a local workstation administrative account every 90 days. We are developing two programs - a VB6 GUI program that will allow the...
1
by: yashgt | last post by:
Hi, We have an application that has been deployed into a virtual folder along with ascx, aspx and the code-behind files. It runs smoothly as long as we don't change any code-behind file. If we...
1
by: st12iker | last post by:
I have a datafile with the following format from which I need to extract parts of the text and copy to a seperate file : Header (line 1) --------------------------- (line 2starts) Content -...
1
by: J. J. Ramsey | last post by:
In Perl, there is a module called "Tie::File". What it does is tie a list to each line of a file. Change the list, and the file is automatically changed, and on top of this, only the bits of the...
7
by: =?Utf-8?B?QnJpYW4gQ29vaw==?= | last post by:
I want to change the font color and weight at a specific position in the text. I am not sure where or what I need to do. It will be at position 155/156 from the left on each line. Here is the...
3
by: Sevla | last post by:
hello, im having a problem to change a particular word in a line, can´t find where is my mistake also i would like to know how to make this program check automatically if a particular word...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.