473,372 Members | 1,039 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,372 software developers and data experts.

I need to split an array

array("a", "b", "c", "d", "e");

I want to now be able to load "b" into a variable ($var) then print it
out

print $var

thanks!

Jul 17 '05 #1
7 11715
Oh and is it possible to change the delimeters of an array to pipes?

Jul 17 '05 #2
.oO(br**********@gmail.com)
Oh and is it possible to change the delimeters of an array to pipes?


Hmm? What delimiters?

Micha
Jul 17 '05 #3
br**********@gmail.com wrote:
array("a", "b", "c", "d", "e");

I want to now be able to load "b" into a variable ($var) then print it
out

print $var


It seems to me like it is time to RTFM. You should lookup arrays
(http://nl.php.net/manual/en/language.types.array.php) and assignment of
variables (like example 12-11 on`
http://nl.php.net/manual/en/language...s.external.php)
Jul 17 '05 #4
br**********@gmail.com wrote:
Oh and is it possible to change the delimeters of an array to pipes?


No, atleast not like: array("a"|"b");

You could use an intermediate string and explode that into an array, see
example 2 on http://nl.php.net/manual/en/function.explode.php
Jul 17 '05 #5

<br**********@gmail.com> wrote in message
news:11**********************@c13g2000cwb.googlegr oups.com...
array("a", "b", "c", "d", "e");
I want to now be able to load "b" into a variable ($var) then print it
out

print $var


array basics.

$var1 = array("a", "b", "c", "d", "e");
$var2= $var1[1]; //element at index 1 contains "b"
echo $var2;

Jul 17 '05 #6
On Tue, 11 Jan 2005 17:36:43 -0800, brianshields wrote:
Oh and is it possible to change the delimeters of an array to pipes?


Delimiters appear in strings. Delimiters in arrays is meaningless.

You are getting array usage confused a little. You don't "split" an
array! An array is formed when you "split()" a string, however.

examples:
<?php
$str = "a,b,c,d,e,f";
$ary = split(",", $str);

echo $ary[2]; // Outputs "c"
?>

<?php
$ary = array("a","b","c","d","e");
$str = join(",",$str); // puts array together into a string
echo $str; // Outputs "a,b,c,d,e"
?>

later...
--
Jeffrey D. Silverman | je**********@jhu.edu
Website | http://www.newtnotes.com

Drop "PANTS" to reply by email

Jul 17 '05 #7
Thanks! I do RTFM and i get lost. Newb. what can i say. Thanks for
spending an extra 5 minutes and explaining it.

Jul 17 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

23
by: Rogers | last post by:
I want to compare strings of numbers that have a circular boundary condition. This means that the string is arranged in a loop without an end-of-string. The comparaison of two strings now...
2
by: jack | last post by:
Hello, I need to plit: "1,34,54,123,34" Into an array list. Thanks for any help, Jack
3
by: Ben | last post by:
Hi I am creating a dynamic function to return a two dimensional array from a delimeted string. The delimited string is like: field1...field2...field3... field1...field2...field3......
3
by: AutoShutdown | last post by:
I am using VBscript in a asp file. lets say I have a value... abc="JDD-20015-19,12" def="JDD-20015-07,8" Question (1)
7
by: fox | last post by:
Hi, Lacking javascript knowledge, I just realized why my project has a bug. I am using ASP to loop through a set of records while it creates URLs with a querystring that has a single value pair....
43
by: SLH | last post by:
hi people. im trying to validate input received via a text area on an ASP page before writing it to a database. i cant use client side javascript due to policy, so it all has to happen on the...
9
by: MrHelpMe | last post by:
Hello again experts, I have successfully pulled data from an LDAP server and now what I want to do is drop the data into a database table. The following is my code that will insert the data but...
2
by: sorobor | last post by:
dear sir .. i am using cakephp freamwork ..By the way i m begener in php and javascript .. My probs r bellow I made a javascript calender ..there is a close button ..when i press close button...
14
by: bcap | last post by:
Hello, I really would apprciate help! =) What I want to do is be able to change the status of mulitple records using a drop down and a checkbox. I have a drop down called "ChangeStatus"...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
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...
0
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...
0
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.