Category : for-loop

I just want to know why I can do that: $Hello->World = $Hello->World ?? []; foreach ($Hello->World as &$world) { $world = $Hello->Lorem($world); } and complete my variable "$Hello->World" with new values, but can’t do that: foreach ($Hello->World ?? [] as &$world) { $world = $Hello->Lorem($world); } The "&$world" reference is broken. Thanks for help! ..

Read more

why i cant get the result i want with this code? for($i=0; $i<count($results); $i++){ if($results[$i]->high == $results[$i]->open and $results[$i]->low == $results[$i]->close and $results[$i]->vol == 0){ unset($results[$i]); } echo json_encode($results); why i still get the same result as if the unset inside the loop not working? but if i call the echo inside the loop its ..

Read more

The file called "file_changes.dat", it´s totally empty, no have any informations, and create in server, i use this script for simple show data from this file, the script it´s the next : $fil_dat_changes=file("file_changes.dat"); $f_changes=fopen("file_changes.dat","w"); for($fh=0;$fh<sizeof($fil_dat_changes);$fh++) { if(trim($fil_dat_changes[$fh])=="") { print "NO DATA"; fputs($f_changes,"".date("dmYHis").""."n"); } else { print "YES EXISTS LINE"; } } fclose($f_changes); And i don´t ..

Read more

Today I made my first ‘for-loop’. I am using Microsoft Graph API PHP and want to echo Calendar Events together with its attendees. Everything is working, however every Ajax Call is noticable slower. Did I take the fastest approach, or is it highly inefficient? Thank you! The call generates the following array of Events attendees: ..

Read more

I have a PHP/MySQL query that returns the following: array ( ‘name’ => ‘Jess’, ‘month’ => ‘2020-03-31 12:28:00’, ‘count’ => ‘1’, ) array ( ‘name’ => ‘Bob’, ‘month’ => ‘2020-04-31 12:28:00’, ‘count’ => ‘2’, ) array ( ‘name’ => ‘Tom’, ‘month’ => ‘2020-05-31 12:28:00’, ‘count’ => ‘2’, ) array ( ‘name’ => ‘Bob’, ‘month’ => ..

Read more