# PHP News, Code, and Stuff

**URL:** <https://ifnotnil.com/t/php-news-code-and-stuff/4256>\
**Category:** PHP\
**Created:** [29 January 2025 16:11 UTC](https://ifnotnil.com/t/php-news-code-and-stuff/4256 "2025-01-29T16:11:43Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![HalGumbert](https://ifnotnil.com/user_avatar/ifnotnil.com/halgumbert/32/2198_2.png) [@HalGumbert](https://ifnotnil.com/u/HalGumbert)\
**Post date:** [29 January 2025 16:11 UTC](https://ifnotnil.com/t/php-news-code-and-stuff/4256/1 "2025-01-29T16:11:43Z")

</div>

Starting a thread to share PHP News, Code, and Stuff…

Jetbrains PHP News

> **[PHP Annotated – January 2025 | The PhpStorm Blog](https://blog.jetbrains.com/phpstorm/2025/01/php-annotated-january-2025/)**
>
> Welcome to the January edition of PHP Annotated! This recap is carefully handcrafted and brings you the most interesting developments in the PHP community over the past couple of months, so you don’t

---

<div class="post-metadata">

**Author:** ![HalGumbert](https://ifnotnil.com/user_avatar/ifnotnil.com/halgumbert/32/2198_2.png) [@HalGumbert](https://ifnotnil.com/u/HalGumbert)\
**Post date:** [29 January 2025 23:52 UTC](https://ifnotnil.com/t/php-news-code-and-stuff/4256/2 "2025-01-29T23:52:31Z")

</div>

Sometimes I like to keep data lookups in a variable using a PHP Associated Array which is similar to a Xojo Dictionary.

I’ve been working on a FileMaker to SalesForce conversion. Of course, the Table and Field Names don’t match, but do have a database table with FM and SF Field Name Pairs. So I query the table and build an Associated Array.

Below is the code that the JetBrains AI returned which I never considered when I asked the best way to query the array.

The idea is simple. Load up an array with data and then call a function that loops thru to find a specific value and return a different specific value.

Here’s the code that the AI suggested. It’s a simple but assumes that the values are unique.

```php
<?php
// Extended Data structure with more fields
$data = [
    [
        'identifier' => 'id1',
        'fm' => 'fm_field_1',
        'sf' => 'sf_field_1',
        'description' => 'Field mapping for object 1',
        'created_date' => '2023-10-01',
    ],
    [
        'identifier' => 'id2',
        'fm' => 'fm_field_2',
        'sf' => 'sf_field_2',
        'description' => 'Field mapping for object 2',
        'created_date' => '2023-10-05',
    ],
];

// Generic function to find values by key
function findValueByKey($data, $searchKey, $searchValue, $returnKey) {
    foreach ($data as $row) {
        if ($row[$searchKey] === $searchValue) {
            return $row[$returnKey] ?? null;
        }
    }
    return null; // Not found
}

// Examples:
// Find 'SF' field using 'identifier'
$sf_field = findValueByKey($data, 'identifier', 'id1', 'sf');
echo "SF Field: " . $sf_field . PHP_EOL;

// Find 'description' using 'SF' field
$description = findValueByKey($data, 'sf', 'sf_field_1', 'description');
echo "Description: " . $description . PHP_EOL;

// Find 'created_date' using 'FM' field
$created_date = findValueByKey($data, 'fm', 'fm_field_2', 'created_date');
echo "Created Date: " . $created_date . PHP_EOL;
?>

```

---

<div class="post-metadata">

**Author:** ![Abbie](https://ifnotnil.com/user_avatar/ifnotnil.com/abbie/32/4533_2.png) [@Abbie](https://ifnotnil.com/u/Abbie)\
**Post date:** [30 January 2025 23:55 UTC](https://ifnotnil.com/t/php-news-code-and-stuff/4256/3 "2025-01-30T23:55:50Z")

</div>

wouldn’t be faster do do this in SQL?

---

<div class="post-metadata">

**Author:** ![JeanYves](https://ifnotnil.com/user_avatar/ifnotnil.com/jeanyves/32/4870_2.png) [@JeanYves](https://ifnotnil.com/u/JeanYves)\
**Post date:** [31 January 2025 08:41 UTC](https://ifnotnil.com/t/php-news-code-and-stuff/4256/4 "2025-01-31T08:41:19Z")

</div>

I gave the IA the structure of the two tables, and told it to make a sql insert from one table to another using similar fields names. and it worked great…

---

<div class="post-metadata">

**Author:** ![HalGumbert](https://ifnotnil.com/user_avatar/ifnotnil.com/halgumbert/32/2198_2.png) [@HalGumbert](https://ifnotnil.com/u/HalGumbert)\
**Post date:** [31 January 2025 14:29 UTC](https://ifnotnil.com/t/php-news-code-and-stuff/4256/5 "2025-01-31T14:29:46Z")

</div>

> [@Abbie](#):
>
> wouldn’t be faster do do this in SQL?

In this case, it would be calling the look ups over and over rapidly. So having the values in ram is faster.

I have a different project where I store a lot of schema data in sql, but I also cache that data in an assoc array since it’s referenced a lot.

---

<div class="post-metadata">

**Author:** ![Abbie](https://ifnotnil.com/user_avatar/ifnotnil.com/abbie/32/4533_2.png) [@Abbie](https://ifnotnil.com/u/Abbie)\
**Post date:** [31 January 2025 14:37 UTC](https://ifnotnil.com/t/php-news-code-and-stuff/4256/6 "2025-01-31T14:37:23Z")

</div>

In SQL it’s one insert to move to a table with different field names.

```auto
INSERT INTO table2 (colname1, colname2, ... )
Select (t1colname1, ...) from table one

```

You can also manipulate the data inside the insert statement to make adjustments for datatypes, formatting, editing the data or inserting new fields based on existing data. usually data migrations can be done in very few statements.

---

<div class="post-metadata">

**Author:** ![HalGumbert](https://ifnotnil.com/user_avatar/ifnotnil.com/halgumbert/32/2198_2.png) [@HalGumbert](https://ifnotnil.com/u/HalGumbert)\
**Post date:** [31 January 2025 14:41 UTC](https://ifnotnil.com/t/php-news-code-and-stuff/4256/7 "2025-01-31T14:41:25Z")

</div>

> [@Abbie](#):
>
> In SQL it’s one insert to move to a table with different field names

That’d be perfect if it was all in sql. The project I’m working on is selecting records from FileMaker and inserting records into SalesForce via an API running on an intermediary PHP box.

The data comes in with FileMaker column names, then translated to the SalesForce column names for the insert.

---

<div class="post-metadata">

**Author:** ![Abbie](https://ifnotnil.com/user_avatar/ifnotnil.com/abbie/32/4533_2.png) [@Abbie](https://ifnotnil.com/u/Abbie)\
**Post date:** [31 January 2025 14:52 UTC](https://ifnotnil.com/t/php-news-code-and-stuff/4256/8 "2025-01-31T14:52:31Z")

</div>

Just make it all SQL? 🙂

Context is I’ve spent years doing data migrations on legacy healthcare systems (and it sucked btw: half the reasons for migration were non-normalized table. Field first address, field second address, field third address etc.). The fastest way was usually to wholesale export the data from one system, and import it into the next. SQL would be the intermediary to change the data into what was expected for the next system, and then exported into whatever was needed for the final import.

When the system didn’t have an export, then we’d have to scrape from usually a telnet session 😭, but we’d get the data in one go, that way we could test and verify it was valid, instead of converting by item.

FileMaker has a CSV export. Salesforce can import chunks using CSV or SOAP (iirc, SOAP was for stuff over 50 or 100k records?).

---

<div class="post-metadata">

**Author:** ![HalGumbert](https://ifnotnil.com/user_avatar/ifnotnil.com/halgumbert/32/2198_2.png) [@HalGumbert](https://ifnotnil.com/u/HalGumbert)\
**Post date:** [31 January 2025 14:58 UTC](https://ifnotnil.com/t/php-news-code-and-stuff/4256/9 "2025-01-31T14:58:30Z")

</div>

> [@Abbie](#):
>
> Just make it all SQL?

You have a log of good ideas! 🙂

We did that for the initial import and some update imports. I suppose we could do that with what this project is doing, except this process needs to be semi-automated. The user will import into FileMaker which then asks php to do on the fly inserts. Cool stuff, except for the SalesForce API being a bit yucky.

---

<div class="post-metadata">

**Author:** ![Abbie](https://ifnotnil.com/user_avatar/ifnotnil.com/abbie/32/4533_2.png) [@Abbie](https://ifnotnil.com/u/Abbie)\
**Post date:** [31 January 2025 15:13 UTC](https://ifnotnil.com/t/php-news-code-and-stuff/4256/10 "2025-01-31T15:13:26Z")

</div>

I didn’t realize this was a live process. I’m more comfortable with my initial reaction of WTF? 🤣 🤣 Having a loop for a data import concerns me so much, and brings bad memories LOL. And it was so painfully common among hospitals.

I’d still use SQL and likely batch things, because I don’t think I worked with any systems that could handle a constant load. Most places had daily batches, some hourly.

The few live places i worked with I think I mostly used C#. A few had a VBA requirement. My stomach turns remembering it, so I’ll save that story for the therapist.

If on the fly inserts are an option, it sounds like it could be fun to do and spend time making excessively efficient.

I think i’d gravitate to C# for this too. Admittedly, largely because the code lives in my head. If php does it, php does it. I couldn’t say if one option was better offhand without looking into it, but my bias has a very definite lean. 😃

---

<div class="post-metadata">

**Author:** ![HalGumbert](https://ifnotnil.com/user_avatar/ifnotnil.com/halgumbert/32/2198_2.png) [@HalGumbert](https://ifnotnil.com/u/HalGumbert)\
**Post date:** [2 February 2025 20:59 UTC](https://ifnotnil.com/t/php-news-code-and-stuff/4256/11 "2025-02-02T20:59:32Z")

</div>

I’m aways on the look out for how to do things better.

When a Button is Clicked and code is to be run in PHP on the Server, I normally just AJAX which is just a way that Javascript can make a Web Request in without Reloading the Page. That’s essentially a “Xojo Web Round Trip” where you have to wait for the Web Round Trip to complete before getting any feedback.

Recently I learned about HTML Server-Sent Events API. Check out how I use it in Xanadu below.

Server-Sent Events is crazy simple. Just instantiate an EventSource where you pass a URL to a PHP page and handle EventSource.onMessage events. Then in PHP you do your work and send data back to be processed in the EventSource.onMessage handler.

Easy peasy! Just like Xojo Web 1.0 Round Trips but with the ability to send progress info back.

Some code:  
[https://www.w3schools.com/html/html5\_serversentevents.asp](https://www.w3schools.com/html/html5_serversentevents.asp)

![SSE_Example](https://ifnotnil.com/uploads/default/original/2X/5/512e7aa9963826c836d78ddf62ee92e51c6ab478.gif)

---

<div class="post-metadata">

**Author:** ![HalGumbert](https://ifnotnil.com/user_avatar/ifnotnil.com/halgumbert/32/2198_2.png) [@HalGumbert](https://ifnotnil.com/u/HalGumbert)\
**Post date:** [4 February 2025 23:12 UTC](https://ifnotnil.com/t/php-news-code-and-stuff/4256/12 "2025-02-04T23:12:50Z")

</div>

I work on Xanadu a lot. Recently, I’ve been working on the results UI.

Can now change the page of selected recs at the top select or the button group at the bottom.

Front end work is so detailed…

 ![image](https://ifnotnil.com/uploads/default/original/2X/9/9ee29a10a3c99c995cca49fd0702f4006a234de6.png)

---

<div class="post-metadata">

**Author:** ![HalGumbert](https://ifnotnil.com/user_avatar/ifnotnil.com/halgumbert/32/2198_2.png) [@HalGumbert](https://ifnotnil.com/u/HalGumbert)\
**Post date:** [5 February 2025 17:41 UTC](https://ifnotnil.com/t/php-news-code-and-stuff/4256/13 "2025-02-05T17:41:46Z")

</div>

State of PHP 2024 Report from Jetbrains was published,

> **[The State of PHP 2024 – Expert review](https://blog.jetbrains.com/phpstorm/2025/02/state-of-php-2024/)**
>
> Explore trends in the PHP ecosystem based on the State of Developer Ecosystem Report 2024 by JetBrains.

 ![image](https://ifnotnil.com/uploads/default/original/2X/e/e9ad261c174f6fbb7d40b6d1fdc3f14ce38e46c1.png)

 ![image](https://ifnotnil.com/uploads/default/original/2X/4/43a12d00138dd78d890b92efe40c3323ef12f2aa.jpeg)

---

<div class="post-metadata">

**Author:** ![Abbie](https://ifnotnil.com/user_avatar/ifnotnil.com/abbie/32/4533_2.png) [@Abbie](https://ifnotnil.com/u/Abbie)\
**Post date:** [5 February 2025 19:49 UTC](https://ifnotnil.com/t/php-news-code-and-stuff/4256/14 "2025-02-05T19:49:20Z")

</div>

So i started a PHP project this morning, was supposed to be a quick and dirty, and its been a few years.

I’m making a lot of mistakes today lol.

---

<div class="post-metadata">

**Author:** ![HalGumbert](https://ifnotnil.com/user_avatar/ifnotnil.com/halgumbert/32/2198_2.png) [@HalGumbert](https://ifnotnil.com/u/HalGumbert)\
**Post date:** [6 February 2025 15:25 UTC](https://ifnotnil.com/t/php-news-code-and-stuff/4256/15 "2025-02-06T15:25:50Z")

</div>

> [@Abbie](#):
>
> PHP project this morning

What are you working on?

---

<div class="post-metadata">

**Author:** ![Abbie](https://ifnotnil.com/user_avatar/ifnotnil.com/abbie/32/4533_2.png) [@Abbie](https://ifnotnil.com/u/Abbie)\
**Post date:** [6 February 2025 19:23 UTC](https://ifnotnil.com/t/php-news-code-and-stuff/4256/16 "2025-02-06T19:23:47Z")

</div>

migrating client’s custom stuff off WordPress.  
I keep getting into c# brain and doing things that obviously don’t work in php.

today is better tho. I’m remembering the dollar signs 🤣

---

<div class="post-metadata">

**Author:** ![HalGumbert](https://ifnotnil.com/user_avatar/ifnotnil.com/halgumbert/32/2198_2.png) [@HalGumbert](https://ifnotnil.com/u/HalGumbert)\
**Post date:** [7 February 2025 16:49 UTC](https://ifnotnil.com/t/php-news-code-and-stuff/4256/17 "2025-02-07T16:49:43Z")

</div>

# The Future of Server-Rendered Web Components: Enhance vs. Lit vs. WebC

Interesting article…

[https://heyvivek.com/the-future-of-server-rendered-web-components-enhance-vs-lit-vs-webc](https://heyvivek.com/the-future-of-server-rendered-web-components-enhance-vs-lit-vs-webc)

---

<div class="post-metadata">

**Author:** ![HalGumbert](https://ifnotnil.com/user_avatar/ifnotnil.com/halgumbert/32/2198_2.png) [@HalGumbert](https://ifnotnil.com/u/HalGumbert)\
**Post date:** [3 March 2025 14:41 UTC](https://ifnotnil.com/t/php-news-code-and-stuff/4256/18 "2025-03-03T14:41:24Z")

</div>

This is interesting, but not yet available.

> **[CSS Custom Functions are coming … and they are going to be a game changer!](https://www.bram.us/2025/02/09/css-custom-functions-teaser/)**
>
> Chrome is currently prototyping CSS Functions, which is very exciting!

Discussion:

> **[CSS Custom Functions are coming](https://news.ycombinator.com/item?id=43236126)**
>
> 76 points —
> 70 comments —
> Fudgel —
> 10:52 PM - 2 Mar 2025

---

<div class="post-metadata">

**Author:** ![HalGumbert](https://ifnotnil.com/user_avatar/ifnotnil.com/halgumbert/32/2198_2.png) [@HalGumbert](https://ifnotnil.com/u/HalGumbert)\
**Post date:** [3 April 2025 17:52 UTC](https://ifnotnil.com/t/php-news-code-and-stuff/4256/19 "2025-04-03T17:52:43Z")

</div>

First Bootstrap update in over a year:

> **[Release v5.3.4 · twbs/bootstrap](https://github.com/twbs/bootstrap/releases/tag/v5.3.4)**
>
> Changes
> 
> \#40888: Dependabot: switch to grouped updates
> 
> 🚀 Features
> 
> \#41299: Typo fixed
> \#41187: Docs: mention removal of util.js in migration guide
> \#41228: Docs: Simplify ids for checks, radios and ...

---

<div class="post-metadata">

**Author:** ![HalGumbert](https://ifnotnil.com/user_avatar/ifnotnil.com/halgumbert/32/2198_2.png) [@HalGumbert](https://ifnotnil.com/u/HalGumbert)\
**Post date:** [3 April 2025 17:56 UTC](https://ifnotnil.com/t/php-news-code-and-stuff/4256/20 "2025-04-03T17:56:03Z")

</div>

A week or so ago, Web Awesome said their release would be pushed back to June from April.

 ![image](https://ifnotnil.com/uploads/default/original/2X/b/bb658e329a7c65792a848e5fcde05187b2d78947.png)

Previously:

 ![image](https://ifnotnil.com/uploads/default/original/2X/5/5b7cbc5ba516f80cc25aca56d1bdb1d6be93b48f.png)

[Next page](https://ifnotnil.com/t/php-news-code-and-stuff/4256.md?page=2)
