PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
eshban
Forum Contributor
Posts: 184 Joined: Mon Sep 05, 2005 1:38 am
Post
by eshban » Wed Dec 20, 2006 12:46 am
I s there any way to convert PHP array in PHP STRING
like i have an array which has following info
Code: Select all
Array
(
[0] => check_files/toplogo.png
[1] => check_files/topphp.png
[2] => check_files/shadow_tr.jpg
[3] => check_files/shadow_bl.jpg
[4] => check_files/shadow_br.jpg
)
How can i see these path in a string
thanks
Kieran Huggins
DevNet Master
Posts: 3635 Joined: Wed Dec 06, 2006 4:14 pm
Location: Toronto, Canada
Contact:
Post
by Kieran Huggins » Wed Dec 20, 2006 12:59 am
um... each element in that array IS a string!
I might be missing your question...
Cheers,
Kieran
eshban
Forum Contributor
Posts: 184 Joined: Mon Sep 05, 2005 1:38 am
Post
by eshban » Wed Dec 20, 2006 1:04 am
i mean that how can i save the contents of array in a variable or a session variable to use it later
Kieran Huggins
DevNet Master
Posts: 3635 Joined: Wed Dec 06, 2006 4:14 pm
Location: Toronto, Canada
Contact:
Post
by Kieran Huggins » Wed Dec 20, 2006 1:10 am
still not getting it...
daedalus__
DevNet Resident
Posts: 1925 Joined: Thu Feb 09, 2006 4:52 pm
Post
by daedalus__ » Wed Dec 20, 2006 2:13 am
wow, i didn't understand before and i surely hope that i do not know but might this be what you are asking?
Code: Select all
$string_array = array('i', 'hope', 'im', 'wrong');
jmut
Forum Regular
Posts: 945 Joined: Tue Jul 05, 2005 3:54 am
Location: Sofia, Bulgaria
Contact:
Post
by jmut » Wed Dec 20, 2006 2:18 am
eshban wrote: I s there any way to convert PHP array in PHP STRING
like i have an array which has following info
Code: Select all
Array
(
[0] => check_files/toplogo.png
[1] => check_files/topphp.png
[2] => check_files/shadow_tr.jpg
[3] => check_files/shadow_bl.jpg
[4] => check_files/shadow_br.jpg
)
How can i see these path in a string
thanks
http://php.net/serialize
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098 Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia
Post
by Chris Corbyn » Wed Dec 20, 2006 2:44 am
I know what you're looking for
print_r($array);
or
var_dump($array);
dibyendrah
Forum Contributor
Posts: 491 Joined: Wed Oct 19, 2005 5:14 am
Location: Nepal
Contact:
Post
by dibyendrah » Wed Dec 20, 2006 5:10 am
I guess you're trying to see the array elements
Use following code snippets :
Code: Select all
foreach ($array as $key=>$value){
print $value."\n";
}
Code: Select all
for($i=0; $i<count($array); $i++){
print $array[$i]."\n";
}
or just see all the array using print_r($array) or var_dump($array)
Jenk
DevNet Master
Posts: 3587 Joined: Mon Sep 19, 2005 6:24 am
Location: London
Post
by Jenk » Wed Dec 20, 2006 5:51 am
Code: Select all
<?php
session_start();
$_SESSION['MyArray'] = array('a', 'b', 'c', 'd');
?>