Comment

Comment by whiskers

It's not quite what you're asking for, but there is a way to handle array results from functions where you know the number of elements that will be returned.

For example:

// explode splits the string on the provided boundary

// and returns an array containing each segment.

// using list() we can assign the two segments to two

// variables within the same statement

$size = "1000x1000";

list( $width, $height ) = explode( "x", $size );

parent whiskers 15 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton