All Questions
72,226
questions
0
votes
1
answer
28
views
CSV backslash create issue while procession file data
I am trying to process a CSV file in which one column contains JSON formatted data. In this JSON data, some fields use backslashes, which creates a problem when mapping fields with their values.
Link ...
-1
votes
0
answers
20
views
Output an object's value without looping [duplicate]
I'm trying to var_dump the guid value in this object without setting up a foreach loop. I think the ["2"] key is throwing me off. This data is coming from the Toast API. Any help would be ...
-2
votes
0
answers
19
views
How to find matching words and phrases in two strings with php [closed]
I have two strings. In the spam.php file, $bad_words list looks like this (they can be a word or phrases):
$bad_words = "
kittens
fake driver license
real passports
buy passports
buy driver ...
1
vote
1
answer
50
views
Filter multideminsional array in PHP so that if certain values are duplicated in sub-arrays the redundant ones are unset [closed]
In an application, redundant but non-identical arrays are being returned. I'd like to remove the redundant arrays from the multidimensional array. Though the issue could possibly be solved closer to ...
-1
votes
0
answers
20
views
understanding json_decode data [duplicate]
When I use json_decode and look at the results, I get a list of objects and arrays. I specifically want to retrieve one piece of information, but I'm not sure how to get it. I seem to have a stdClass ...
0
votes
1
answer
69
views
I keep getting this error "Cannot access offset of type string on string" whenever I try to serve dummy data to my Laravel application [closed]
I am trying to serve some data to my view. However, when i try to access the elements in my dummy array, i keep getting an error "Cannot access offset of type string on string". And I don't ...
0
votes
0
answers
35
views
Ternary in an array, string PHP [closed]
array
(
'head' => "Birth and Early Years",
'text' => array
(
"Jason A. Cloud was on <a href=''>Bellona</a>, Prime Hospital, to <a href='...
-1
votes
1
answer
70
views
array_filter() returning the entire array instead of just the key value [duplicate]
I am doing a work around with PHP array_filter() function. I am noticing a strange. Let me explain.
This is an array $languageDataArray:-
$languageDataArray = array(
array(
'id' => 1,
...
0
votes
0
answers
55
views
Push entries into a result array from deepest nested loop, but also push an entry when deepest loop is not reached
I am creating an array for an order to then pass this data to stripe, the array has multiple forEach clauses.
The issue I am facing is, if the order item(s) does not have menu_options it is not ...
-3
votes
0
answers
39
views
How does the 'as' syntax work in foreach? [duplicate]
I am struggling with how the 'as' works in arrays.
Also a bit confused on the breakup of the $name and $grade.
$studentGrades = [
'John' => 90,
'Mary' => 94,
'Cindy' => 80
];
foreach($...
1
vote
1
answer
31
views
Trying to access array offset on value of type bool - PHP 8.1 - Wordpress - Mulivendorx plugin
I get this error when this code is run as a Wordpress code snippet using WP Code plugin. I'm sure it has to do with the code provided by the plugin developer being out of date, not in-line with ...
-2
votes
0
answers
16
views
Dynamic menu building and navigation using URL parameters
<!DOCTYPE html>
<html lang="en">
<head>
<title>Web Programming using PHP - Coursework 2 - Task 1</title>
</head>
<body>
<header>
...
2
votes
0
answers
29
views
File() only returns one array element [duplicate]
I'm trying to read a copy of my servers firewall deny list into an array but only one array element is returned. Here is a part of the list:
46.229.168.0/24 # {do not delete} - Thu Nov 14 01:23:31 ...
-2
votes
0
answers
33
views
why i getting this error undefined variable even though i already defined and assigned its value [duplicate]
(https://i.sstatic.net/bJvOL2Ur.png)](https://i.sstatic.net/8MWfEweT.png)
i already defined and assigned the the value of $movieInfo but i kept getting this error also i checked if there is a ...
-1
votes
0
answers
34
views
Parse flat array of delimited strings into a flat associative array [duplicate]
I need help here, Im new in php and I try to get a clean output in php, but if I run:
print_r($result)
I got output like this:
Array
(
[0] => Name: Donna D. Westmoreland
[1] => Address: 126 ...