Skip to main content
Filter by
Sorted by
Tagged with
1 vote
1 answer
57 views

I want to combine two associative arrays with different amount of keys and keep all the keys in the final array even if they are null or empty I have tried array_merge but the keys that are not ...
Jalagui's user avatar
  • 35
1 vote
4 answers
114 views

Is there a shorthand for the following code: $result = array_combine( array_map(fn($elem) => "key_$elem", $array), array_map(fn($elem) => "value_$elem", $array) ); ...
plsssineedheeeelp's user avatar
-1 votes
3 answers
40 views

There are two arrays that One is the correct answers and the other is the user's answer. My Php: $i=1; $correct = array('a','d','c','a','b','c'); $user = array('a','c','c','a','c','c'); foreach (...
behroz's user avatar
  • 126
-1 votes
1 answer
59 views

I've an array of arrays in which I've 2 values in each array first one is personID and second one is Skill, there are multiple skills of same persons I need all same skills to add in an array with ...
Rashid's user avatar
  • 286
0 votes
2 answers
37 views

I have 2 Array: $arr1 = Array ( [2] => Array ( [0] => 41000 [1] => 31079 ) [3] => Array ( [0] => 42963 [1] => 41189 ) ) $arr2 = Array ( [2] => ...
Noer Herinnanda Putra's user avatar
-1 votes
2 answers
139 views

Here is my array , I need to loop through this array and check if objects with same docId exists and if they do, I have to combine jArray of these objects FinalArray = [ { "jArray&...
aki's user avatar
  • 315
1 vote
1 answer
44 views

i have an output like this: [ { GolonganName: '3B - Niaga Besar', data: [ 172000 ] }, { GolonganName: '3A - Niaga Kecil', data: [ 76700 ] }, { GolonganName: '2B - Rumah Tangga Menengah', data: [ ...
Fahri Abdurrachman's user avatar
0 votes
1 answer
216 views

I have an object as below, {"metaData":[{"name":"a"},{"name":"b"}],"rows":[[1,2],[3,4],[5,6]]} I would like to change it to [["a"=...
Wahsei's user avatar
  • 307
0 votes
0 answers
40 views

I combined 2 objects as below, but I don't want the keys to be in the output I get. $link1 = '{"Success":true,"Result":[{"eventId":650810,"sportId":"2"...
ThePro's user avatar
  • 31
0 votes
1 answer
2k views

I need to analyze some data taken in my lab but it goes beyond my limited programming skills. I have multiple sets of similar data and I need to take the average of all of these and plot that with ...
Rachel Fister's user avatar
-2 votes
1 answer
158 views

I have two arrays with keys and values and i want to combine them: Array 1 [0]=>string "Width" [1]=>string "Height" [2]=>string "Length" [3]=>string "...
w2God's user avatar
  • 19
0 votes
2 answers
64 views

I have multiple arrays structured like these: $array1 = ["aaa" => 1, "bbb" => 1]; $array2 = ["aaa" => 12, "bbb" => 12]; $array3 = ["bbb" =&...
Lou Nik's user avatar
  • 125
1 vote
2 answers
398 views

I'm trying to combine 2 rows with the same identity. I've been looking for a solution, but somehow can't find a working solution. I'm trying to make a tracker for my stocks, but I want it to combine ...
Osman P.'s user avatar
-2 votes
2 answers
173 views

Problem i have two multidimensional arrays that look like this, 1st Array array( [0] => Array ( [course_id] => 10 [topic] => Booda-hood, advice and an important ...
Atif Raja's user avatar
0 votes
2 answers
421 views

I want to combine data only if value is exist. example: // array 1 array:4 [▼ 0 => "qwfd" 1 => "qw2e3" 2 => null 3 => null ] // array 2 array:4 [▼ 0 => &...
mafortis's user avatar
  • 7,188
1 vote
1 answer
1k views

this is what I wish for... INPUT [1,2,3,4,5] OUTPUT 12345 I've tried this but it didn't work... l1 = [1,2,3,4,5,6] print([int(n1) for n1 in str(l1).split() if n1.isdigit()])
ahmed_elghoroury's user avatar
-1 votes
1 answer
104 views

I am simply trying to add a set of keys and values to an array if and only if they are not already in the array. I need to add d1 thru d20 when they are not already in the array, Here is my code. ...
David Weisser's user avatar
1 vote
1 answer
100 views

I have a db in which I store 20 demographics. The demographics come from a csv and are stored in array. Each array key is a placeholder: d1, d2, up to d20. The incoming data may be [race, gender, ...
David Weisser's user avatar
0 votes
1 answer
66 views

Apologies if this question is close to others. I have tried every solution to accomplish something simple with nothing but failure. :-( I want the keys from array one to be assigned as keys to array ...
David Weisser's user avatar
1 vote
3 answers
332 views

I have a string like this: "ALARM_ID/I4=1010001 ALARM_STATE/U4=eventcode ALARM_TEXT/A=WMR_MAP_EXPORT LOTS/A[1]=[ STEFANO ] ALARM_STATE/U1=1 WAFER/U4=1 VI_KLARF_MAP/A=/test/klarf.map KLARF_STEPID/...
Stefano Radaelli's user avatar
0 votes
1 answer
345 views

The below code is generating several of the below error and it's pointing to PHP Warning: array_merge(): Expected parameter 1 to be an array, null given in /home/mike/snmpCode.php on line 20 PHP ...
Mike T's user avatar
  • 47
1 vote
0 answers
60 views

I am very much a numbie to python. DISPLAY should read: surname, Firstname, Day1 ,Day2,Both Days,NoDays I have 2 txt files. employee.txt has the above information. confpack has 2 lines : 1. going 2. ...
Nena Carreira's user avatar
-1 votes
2 answers
203 views

hi all i have 2 arrays [0] => CD Alaves [1] => Granada CF [2] => Getafe [3] => CD Leganes [4] => Barcelona [5] => Getafe [6] => Atletico Madrid [7] => Getafe [8] => Sevilla ...
miikegunn's user avatar
0 votes
1 answer
413 views

I have the following issue that seems common but can't figure out which array function might work for the following format: (Already tried array_merge , array_merge_recursive , array_combine, ...
user7616631's user avatar
-1 votes
3 answers
231 views

Using the following code I am able to convert an uploaded CSV file into a php array.. <?PHP function readCSV($csvFile){ $file_handle = fopen($csvFile, 'r'); fgetcsv($file_handle); ...
Glen Keybit's user avatar
-3 votes
1 answer
327 views

I have a situation in PHP where I need to combine multiple array values and bind with the first array key, Let say I have following array, [services] => Array ( [0] => 1 ...
Shikhar's user avatar
1 vote
1 answer
71 views

I get the information from the database. For example, my database data is as follows: I get the information from the database. For example, my database data is as follows: ----------------------------...
HajAli's user avatar
  • 49
0 votes
2 answers
874 views

I wish to make Key and Value combining with 2 arrays, but both arrays are not equal. $array1 = array("1","2","3","4","5"); $array2 = array("apple","banana","","dog",""); $key_value = array_combine($...
Balaji P's user avatar
-1 votes
2 answers
464 views

Here is the full csv file to which this problem pertains. I don't understand how the error Warning: array_combine() expects parameter 2 to be array, boolean given in C:\xampp\htdocs\kalugi\...
user136649's user avatar
1 vote
0 answers
722 views

For the following CSV file (3MB): ACDF_cut.csv And for the following code: <?php $file = fopen("ACDF_cut.csv","r"); $file2 = fopen("ACDF_cut_rounded.csv","w"); /* Map Rows and Loop Through ...
user136649's user avatar
0 votes
1 answer
62 views

I have following content: $staticArray = ['group_1', 'group_2']; foreach ($staticArray as $name){ $names[] = $name; } $staticArray2 = ['one', 'two']; $i = 0; foreach ($staticArray2 as $name){ ...
Carolina Ramirez's user avatar
0 votes
0 answers
64 views

I have a problem with Array_combine function. I want to combine prices to set as products keys. First I get everything as string from html form. and use explode function make it array. this process ...
Madlen Baba's user avatar
-2 votes
2 answers
66 views

i have problem to combine values based on id. I have data like this : Array( [0] => Array( [id] => 1, [id_name] => a [id_vales] => 5 ) [1] => ...
axhxs's user avatar
  • 15
-1 votes
1 answer
121 views

I have a form with dynamic inputs, in this case, I take a car owner with multiple cars, so for the same person/client I need to save several cars with the brand name and year model: <form action="...
Andrewfreites's user avatar
-1 votes
1 answer
416 views

i have two arrays :- $a1=array(1,1,2,3,1);<br> $a2=array("m","m","s","xl","s"); i want this as output what should i do :- Array ( [0] => Array ( [0] => 1 ...
hemant singh's user avatar
-1 votes
1 answer
84 views

Array_combine remove duplicate array <?php $a1=array("red","red"); $a2=array("blue","yellow"); print_r(array_combine($a1,$a2)); ?> This code give output : ...
Anuj Kumar's user avatar
-2 votes
2 answers
215 views

[0] => Array ( [id] => 004002718 [price] => 5.00 [category] => x ) [1] => Array ( [id] => 030285882 [price] => 8.99 [...
dean2020's user avatar
  • 665
0 votes
0 answers
120 views

I'm working on file import feature from an Excel file. During the import, I'm using PhpSpreadSheet library to convert this file to CSV format. Next, my function extractData() will loop csv file, ...
Maestro's user avatar
  • 855
0 votes
1 answer
179 views

I have two arrays and I want to merge the values of the two arrays into a single array, but both arrays have different values. Example: var arr1 = [ { data1: 1 ,data2: "value1"}, ...
Shubham Seth's user avatar
0 votes
1 answer
539 views

i have three variables ($product_id, $size_id, $quantity) which get from "form" and insert into the pending_order table.So i used the array_combine function to combine three variables and than using ...
Sibtain Raza's user avatar
-1 votes
1 answer
40 views

Let's say I have following arrays: Array ( [2001] => Array ( [event_detail] => Array ( [1] => Array ( ...
Subhankar Acharjee's user avatar
2 votes
1 answer
174 views

I am using the following code to get two arrays into one json result. But getting only the first index as result. Is there any error in the code or anybody can suggest an alternate method to get the ...
Jerry Jones's user avatar
0 votes
3 answers
64 views

<?php $keys = array(1,1,2,1,1); $values = array(1,1,1,1,1); $result = array_combine ($keys, $values); ?> I want to add the second array values. For example $result will display the output as $...
Bilal Rehman's user avatar
-2 votes
2 answers
540 views

I have two strings and i want to concatenate string like john+smith to jsomhinth. i did this but array_combine not showing the result set. array_combine is not working here What is the use of ...
Gaurav Pandey's user avatar
2 votes
9 answers
6k views

I have a string like this: $string = 'Apple, Orange, Lemone'; I want to make this string to: $array = array('apple'=>'Apple', 'orang'=>'Orange', 'lemone'=>'Lemone'); How to achieve this? I ...
Salih K's user avatar
  • 711
0 votes
4 answers
104 views

I'm looking for a solution to create an array of associative arrays from an array of indexed array where the first row should be used as the keys for all subsequent rows. What I have is a csv/xls file ...
ndAR's user avatar
  • 381
1 vote
3 answers
1k views

To save on typing out the key name for every single array, I want to be able to build lists like. $lists = [ ['A', 'B', 'C', 'D', 'E'], ['A', 'B', 'C', 'D', 'E'], ['A', 'B', 'C', 'D', 'E'],...
Damian Cardona's user avatar
0 votes
2 answers
55 views

I've created a method that allows me to assign keys to rows of values, and appends extra keys and values. It adds all the new keys to a keys array, then adds all new values to the values array, and ...
BernardoLima's user avatar
  • 1,141
1 vote
7 answers
190 views

I am trying to combine keys and values in arrays. I have an product_id with different price. Let say Product id and price id 101 and price is 100 id 105 and price is 200 id 101 and price is 300 ...
Vignesh Pichamani's user avatar
1 vote
2 answers
611 views

In PHP, I have 2 multidimensional arrays. such as: array 1: [[1, 2, 3], [1, 2, 3]]; Array 2: [[4, 5, 6], [7, 8, 9]]; I need to combine these two arrays. I need the first array's subarray values to ...
Stalin's user avatar
  • 11