skip to Main Content

PHP – get closest date from array – Laravel

I want to get closest date from $search_date if is not same values in $array['date']. If is same value in $array['date'] I want all array. Format date is 'Y-m-d'. Example 1: $search_date = '2022-12-08'; $array = [{"price":"200","date":"2022-12-12"},{"price":"50","date":"2022-12-10"},{"price":"100","date":"2022-12-10"}] Return should be:…

VIEW QUESTION

livewire array inputs how to fix? – Laravel

my component livewire public $images = []; public function rules() { return [ 'images.*.name' => 'required|max:255', ]; } blade.php <div id="images"> @foreach($images as $index => $image) <div class="card" wire:key="image-field-{{$images[$index]['id']}}"> <img src="{{$images[$index]->original_url}}" class="card-img-top" alt="{{$images[$index]->name}}" /> <input type="text" name="item-{{$index}}-name" id="item.{{$index}}.name" wire:model="images.{{$index}}.name" />…

VIEW QUESTION

Find entry in JSON (Kraken.com uncommon JSON format) – PHP

I need to find if a string exists in JSON Kraken.com retrieved file: I get it this way: $sURL = "https://api.kraken.com/0/public/OHLC?pair=ETHAED&interval=5&since=". strtotime("-1 day"); $ch = curl_init(); $config['useragent'] = 'Mozilla/5.0 (Windows NT 6.2; WOW64; rv:17.0) Gecko/20100101 Firefox/17.0'; curl_setopt($ch, CURLOPT_USERAGENT, $config['useragent']); curl_setopt($ch,…

VIEW QUESTION
Back To Top
Search