Tagged Questions
0
votes
4answers
29 views
walking through php array
Can anyone point me in the right direction with the below
I have this HTML in a FROM (simplified for this example):
=============== Start HTML ===================
<select name="Postage[]" ...
0
votes
1answer
12 views
Symfony2 - how to display/insert an Array in Database from a Form?
I am stuck with a piece of code that i can't resolve.
I have an Entity, having some arguments. One of them is an Array.
I would like to display it in a Form as several <select> tags.
For ...
0
votes
1answer
16 views
output xml array parsing php repeated six times
I have a php file in this format:
<?php
$username = "root";
$password= "";
$db = "kamus1";
mysql_connect("localhost",$username,$password) or die("koneksi ke MySQL gagal");
mysql_select_db($db) or ...
1
vote
3answers
34 views
php, change keys in an array?
Hi I have an array like below.
$arr = Array ( [My_name] => Sam [My_location] => United_Kingdom [My_id] => 1 );
And im trying to change the keys from
My_name, My_Location, My_id
to
...
1
vote
6answers
46 views
How can I change the named keys in an associative array
The following code returns an associative array as follows
Array ( [1] => Array (
[url] => example.com
[title] => Title.example
[snippet] => snippet.example
) )
$blekkoArray = ...
2
votes
2answers
25 views
Performing functions on array items in a single line
<?php
$fruits = "lemon
orange
banana
apple
pear";
$fruits_a = explode("\n", $fruits);
for ($i = 0; $i < count($fruits_a); $i++)
{
$fruits_a[$i] = trim($fruits_a[$i]);
}
$fruits = ...
-1
votes
1answer
20 views
adjust keys in an array
For example I have the following array :
$arr[0] = "1"
$arr[7] = "p"
$arr[10] = "c"
$arr[12] = 'k"
How do I transform it to :
$arr[0] = "1"
$arr[1] = "p"
$arr[2] = "c"
$arr[3] = 'k"
4
votes
2answers
66 views
Is there an equivalent to C++'s std::vector in PHP?
Is there a lightweight replacement for PHP's array to be used when I don't need any of the associated array functionality? From what I know, array is a hash map internally, which is excessive and ...
-1
votes
2answers
37 views
adding values in a 2d associative array
The following code returns an associated array with a url,title and snippet from a search engine and it works fine
$js = json_decode($data);
$blekkoArray = array();
...
0
votes
1answer
37 views
Foreach loops and array problems
So after 2 hours of searching I cant seem to find what Im looking for. What I am trying to do is run a foreach loop in an array. I know its not possible but its the only way I can think of explaining ...
-1
votes
4answers
37 views
convert array value to key
I am working in PHP.
I have one array. i need to create language array like ([CN] => Chinese) this format.
My array response is given below.
Array
(
[0] => stdClass Object
(
...
0
votes
1answer
70 views
Get next value in array
I have this array:
<?php
$arrFiles = array_diff(scandir("scans", 0), array(".", ".."));
$arrFiles = array_values($arrFiles);
?>
that prints fine with this:
<?php
...
0
votes
1answer
23 views
How to make an list style array echo
I am working on trying to get spyc working but I keep running into the same problem, whenever I run my code:
<?php
include('spyc.php');
$array = array (
'groups' => array(
...
0
votes
1answer
37 views
Undefined Index for … existing index?
OK, that's more than weird...
Here's my code :
public function results($id,$pattern=3)
{
$this->load->library('session');
if (!$this->session->userdata('logged_in'))
{
...
0
votes
4answers
43 views
PHP Array Re-Arrange
I have some issue to re-arrange array in php. This is what i have...
Array
(
[N] => Array
(
[68] => sssssss ttttttt
[69] => uuuuuu vvvvvvvv
)
...