btherl Posted April 23, 2007 Share Posted April 23, 2007 Is there any is_file_pointer_valid() in php? Something which will tell me either "Yes, that's a file pointer" or "No, whatever that thing is it isn't a file pointer" Link to comment https://forums.phpfreaks.com/topic/48208-solved-check-if-file-pointer-is-valid/ Share on other sites More sharing options...
btherl Posted April 23, 2007 Author Share Posted April 23, 2007 I found the following.. if (is_resource($fp) && get_resource_type($fp) === 'stream') { ... } But it doesn't distinguish between stream types.. to do that you need to use stream_get_meta_data() and look even deeper. I guess that is the price of flexibility. Link to comment https://forums.phpfreaks.com/topic/48208-solved-check-if-file-pointer-is-valid/#findComment-235667 Share on other sites More sharing options...
trq Posted April 23, 2007 Share Posted April 23, 2007 get_resource_type should help you out. Link to comment https://forums.phpfreaks.com/topic/48208-solved-check-if-file-pointer-is-valid/#findComment-235668 Share on other sites More sharing options...
btherl Posted April 23, 2007 Author Share Posted April 23, 2007 Thanks thorpe! I just learnt a whole lot about how complex php's streams and wrappers and so on really are Link to comment https://forums.phpfreaks.com/topic/48208-solved-check-if-file-pointer-is-valid/#findComment-235672 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.