24 means 255.255.255.0 $mask = (int)$mask; $maskLong = ~((1 << (32 - $mask)) - 1); return ($ipLong & $maskLong) === ($subnetLong & $maskLong); } } /** * Split content at marker. * Returns [ 'excerpt' => '...', 'hasMore' => bool ] */ function getExcerptWithMore(string $content): array { // Look for the marker $parts = explode('', $content, 2); if (count($parts) === 2) { // We have an excerpt in $parts[0], and the remainder in $parts[1] return [ 'excerpt' => $parts[0], 'hasMore' => true, ]; } else { // No marker found, so the entire post is $content return [ 'excerpt' => $content, 'hasMore' => false, ]; } }