All Questions
329
questions
0
votes
1
answer
120
views
Check if product bundle has bundle-upsells ( optional items ) or simple bundled items
I am pretty new to coding and trying to edit our WC website a bit.
Hope my English is decent enough to pass the needed information…
I made a function that checks if product is a type- bundle and it ...
0
votes
2
answers
57
views
Find value in multidimensional array based on key
I have an array with multiple array, and in each array one of the fields is another array, see below. I need to find the value for "First name", in the array that has an 'item_id' of value ...
0
votes
3
answers
63
views
Find indexed element in php array with a position [duplicate]
It's weird how simple things like these I cannot find about php on the internet. Without further ado, how do I find an element inside an array that already has a string index, with a position?
For ...
0
votes
3
answers
590
views
Laravel: How to fetch all logged in User Posts using Session variable
I have created a project which allows logged in users to created posts. The post table has a column called post_id. The post_id has the value user id fetched from Session::get('id').
Now I want to ...
1
vote
1
answer
47
views
PHP: How to find a big word in a small one
I have user input like:
$name = 'Alexxxx'
Or
$name = 'Aaaalex'
And I have list of names like:
$names = 'Jack Harry Alex Oscar'
I need to know that user input contains name from a list, but user can ...
0
votes
1
answer
94
views
Find duplicates names in array
My problem is this: I have an array in which I collect all the files of a hard disk, like:
$files = Array(
[0] => E:\\folder1\file1.mp4
[1] => E:\\folder1\folder1a\file2.mp4
[2] =>...
1
vote
1
answer
76
views
How to get all text between two tags including php tags
I have this string:
$str = 'This is the content total <div class="brown">This content brown</div> and this another content <div class="red">This is content brown&...
-3
votes
1
answer
32
views
MongoDb_ find multiple value in one field
{ "_id": "apples", "qty": 5, "packing": "cardboard" }, { "_id": "bananas", "qty": 7 }, { "_id": "oranges&...
-1
votes
2
answers
83
views
Find relative value in array using PHP [duplicate]
I'm trying to get the data in the array according to the input value, like the example below, if I enter the correct value, it will get the value, but when I enter the incorrect value, it doesn't work....
-1
votes
3
answers
89
views
Regex to update URLs after a content migration
I recently moved some old content to a new site and updated some URL structures. I need to do a find-replace on the entire database to update some old links. This would be easy if I knew regex, but I ...
0
votes
1
answer
24
views
php mongodb find syntax issue
I am trying to find the correct syntax for the find command. I have been using the following syntax for a while and it works.
$client = new MongoDB\Client("mongodb://localhost");
$dbs = $...
1
vote
1
answer
55
views
regex get number betwen quotes
i have difrent string json type egz formats in line
{"env":"stato","usc":"00000000","isc":"000100","sn":"0120xxxxmacxxx"}...
0
votes
3
answers
94
views
Check if string has a specific number, not digit [duplicate]
This is what I have:
$a = '3,24,57';
if (strpos($a, '7') == true) {
echo 'number found';
}
The code will return "number found" because of the number 57 but there is no number 7 in the ...
1
vote
2
answers
3k
views
PhpStorm says find method not found
In laravel 8 I made a Model app/Models/Role.php
class Role extends Model
{
use HasFactory;
public function users(): BelongsToMany
{
return $this->belongsToMany(User::class);
...
1
vote
1
answer
27
views
Find and Replace Multi-Row Phrases/text Within PHP Arrays without damaging the array
Lets say I have an array:
$myarray = (
[0] => 'Johnny likes to go to school',
[1] => 'but he only likes to go on Saturday',
[2] => 'because Saturdays are the best days',
[3] => '...