Saturday, September 6, 2025
HomeUncategorisedPHP | stream_is_local() Function

PHP | stream_is_local() Function

The stream_is_local() function is an inbuilt function in PHP which is used to check if a stream is a local stream or URL.

Syntax:

bool stream_is_local( $stream )

Parameters: This function accepts single parameter $stream, which is used to specify the stream to be check.

Return Value: This function returns True on success or False on failure.

Below programs illustrate the stream_is_local() function in PHP:

Program 1:




<?php
  
// PHP program to illustrate
// stream_is_local function
  
$res = stream_is_local($strm);
  
// Print result
var_dump($res);
?>


Output:

bool(false)

Program 2: Program to print the length of array return by the function.




<?php
  
// PHP program to illustrate 
// stream_is_local function
$stream1 = '/neveropen.jpg'; // local
$stream2 = 'file://neveropen.jpg'; // local
$stream3 = 'http://geeksforgeeks.org'; // non local stream
  
// Checking all strings and print result
$local = stream_is_local($stream1);
var_dump($local);
  
$shouldbelocal = stream_is_local($stream2);
var_dump($shouldbelocal);
  
$remote = stream_is_local($stream3);
var_dump($remote);
?>


Output:

bool(true)
bool(false)
bool(false)

Reference: http://php.net/manual/en/function.stream-is-local.php

Whether you’re preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, neveropen Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we’ve already empowered, and we’re here to do the same for you. Don’t miss out – check it out now!
RELATED ARTICLES

Most Popular

Dominic
32270 POSTS0 COMMENTS
Milvus
82 POSTS0 COMMENTS
Nango Kala
6639 POSTS0 COMMENTS
Nicole Veronica
11803 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11869 POSTS0 COMMENTS
Shaida Kate Naidoo
6752 POSTS0 COMMENTS
Ted Musemwa
7029 POSTS0 COMMENTS
Thapelo Manthata
6704 POSTS0 COMMENTS
Umr Jansen
6721 POSTS0 COMMENTS