Hey guys,
I have something like this :
Bank1
Bank2
Bank3
and the list goes on till Bank139.
If I have a string that contains the name of all the banks but including the Empty Lines between them, how do i remove the lines and contain only the name of the banks. For eg : The string now contains : array("bank1", "", "bank2", "", "bank3", ""); , how do i make it array("bank1", "bank2", "bank3");
??? Please help guys...its urgent :(
5 960
The string now contains : array("bank1", "", "bank2", "", "bank3", "");
This is an array not a string. When editing or deleted array elements I prefer the C style FOR loop rather the C# FOREACH which is problematic. [PHP]$size = sizeof($bankarray);
for($c=0;$c<$size,$c++){
if(empty($bankarray[$c]))
unset($bankarray[$c]);
}[/PHP]
hi,
there's some problem with the snippet u have written on the line :
for($c..........
can u tell me wht is it ?
i think just brackets needed in if statement
[PHP]$size = sizeof($bankarray);
for($c=0;$c<$size,$c++){
if(empty($bankarray[$c])) {
unset($bankarray[$c]);
}
} [/PHP]
I have used a comma instead of a semi-colon.
[PHP]for($c=0;$c<$size;$c++){[/PHP]
I have used a comma instead of a semi-colon.
[PHP]for($c=0;$c<$size;$c++){[/PHP]
:D :) hehe I did not see that...
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Rob Gudgeon |
last post by:
Hi
Is it possible to explode a string into an array using more than one
separator? I have database records that contain several values, mostly split
by semi-colons but some older records are...
|
by: William Krick |
last post by:
I have a string containing concatenated ascii "records" that are each
terminated by '\n'.
For testing purposes, I construct sample data like this...
$mystring =...
|
by: Richard Lawrence |
last post by:
Hi there,
I'm having a problem with PHP which I'm not sure how to best solve.
Here is the code:
$fp = fopen("comments.txt", "r");
while(!feof($fp))
{
$line = fgets($fp, 1024);
list($key,...
|
by: frizzle |
last post by:
Hi there,
i have a site with fake folders & files.
htaccess rewrites everything to index.php?vars
now in index.php i decide what file to include with a switch/case
statement.
to define where...
|
by: FFMG |
last post by:
Hi,
I need the php equivalent of explode in one of my app.
I read a very big file and "explode" each line to fill a structure.
The reading of the file, 19Mb, (I will also need to streamline...
|
by: k04jg02 |
last post by:
Python has a nifty operator that will take a container and pass its
elements as function parameters. In Python you can make a list like
so:
x =
Then you can say:
f(*x)
|
by: Davide |
last post by:
Hi All, I'm trying to use explode to separate the result of a textual
file, but it explode me only the first row.
the foo.txt is
pippo pluto
pluto pippo
pippo pippo
....
I use this script...
|
by: Jack |
last post by:
I would like to Explode a string into an array that does not begin at
0 but I can't get it to work.
For example: $MyInfo = array(1 =27,68,31,19,40);
will result in $MyInfo = 27 ... $MyInfo = 40...
|
by: sathyashrayan |
last post by:
Dear group,
The function to be used as follows:
$links = "http://www.campaignindia.in/feature/analysis";
$tag1 = '<div class=feature-wrapper>';
$tag2 = '<h1><a href';
$tag3 = "</a>";
$op =...
|
by: vinpkl |
last post by:
hi all
i want to use explode url for shotening my urls
i have a url like
http://localhost/vineet/products.php?dealer_id=12&category_id=2
This is my navigation php code that has url...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
| |