Work with PHP values and data
Guilty Of PHP articles about Work with PHP values and data
9 articles
-
Read PHP Scalars in serialize() Output and Check Array and Object Round Trips
Recognize integer and string markers, then use round-trip checks to verify array entries and object state without relying on printed output alone.
-
Display, Check, and Change PHP Dates in Explicit Time Zones
Set UTC for current-time output, inspect a parsing warning, then modify a fixed date while keeping its original value and displaying the result in Amsterdam.
-
Pass a PHP Closure to array_map to Look Up Values by Key
Give array_map a callback that receives each key and reads its value from a lookup array, using an arrow function or a traditional anonymous function.
-
Trim, Search, and Replace Text in a PHP String
Follow one ASCII string from trimming and a byte-length check through a position-aware search and replacement of both matching terms.
-
Declare PHP Constants and Read Them Alongside Variables in Functions
Use one example to compare a reassigned variable with constants declared by const and define(), then see how the function uses global for the variable but not the constants.
-
Put a PHP Variable Next to Text Without Changing Its Name
Use double quotes for a straightforward variable, braces when a suffix touches its name, or concatenation to join quoted fragments around its value.
-
Compare PHP Arrays by Keys, Values, and Missing Entries
Use == for a whole-array answer, or compare shared values and directional differences to see which entries need attention.
-
Tell Numbers from Strings When Assigning PHP Variables
Assign whole-number, decimal and quoted-digit values, then use var_dump() to inspect them and compare one variable before and after reassignment.
-
Create a PHP Array, Then Read and Update Its Items
Build a numbered list and a record with named fields, then use their indexes and keys to retrieve, change, and print values.
