{"id":148223,"date":"2018-10-22T04:55:49","date_gmt":"2018-10-22T04:55:49","guid":{"rendered":"https:\/\/webkul.com\/blog\/?p=148223"},"modified":"2018-10-23T04:26:54","modified_gmt":"2018-10-23T04:26:54","slug":"php-file-reading-methods","status":"publish","type":"post","link":"https:\/\/webkul.com\/blog\/php-file-reading-methods\/","title":{"rendered":"PHP File Reading Methods"},"content":{"rendered":"<p style=\"text-align: left\">In <strong>PHP<\/strong> there are many ways to read a file. There is a traditional file handling to read\/write a file and various different methods to get the file content.<br \/>\nIn this article, we will explain the functionality and output of different methods used to read the file.<\/p>\n<h2 style=\"text-align: left\">PHP File Handling Methods :<\/h2>\n<p style=\"text-align: left\">In file handling, first we need to open the file with <strong>fopen()<\/strong> method that we want o read. Methods to get the file content :<\/p>\n<p style=\"text-align: left\"><strong>fgets()<\/strong> : fgets() method read the file line by line. we use <strong>feof<\/strong> command to detect the end of the file and read the file line by line.<\/p>\n<p style=\"text-align: left\"><img decoding=\"async\" class=\"size-full wp-image-148465 aligncenter\" src=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2018\/10\/fgets-1.png\" alt=\"\" width=\"541\" height=\"173\" srcset=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2018\/10\/fgets-1.png 541w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2018\/10\/fgets-1-250x80.png 250w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2018\/10\/fgets-1-300x96.png 300w\" sizes=\"(max-width: 541px) 100vw, 541px\" loading=\"lazy\" \/><\/p>\n<p style=\"text-align: left\"><strong>fread()<\/strong> : fread() method is used when we want to read the file in limited size. We pass the limit in bytes in fread() method, and the method then reads the file to that limit and leave the remaining part of the file.<\/p>\n<p style=\"text-align: left\"><img decoding=\"async\" class=\"alignnone size-full wp-image-148466\" src=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2018\/10\/fread-1.png\" alt=\"\" width=\"531\" height=\"214\" srcset=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2018\/10\/fread-1.png 531w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2018\/10\/fread-1-250x101.png 250w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2018\/10\/fread-1-300x121.png 300w\" sizes=\"(max-width: 531px) 100vw, 531px\" loading=\"lazy\" \/><\/p>\n<p style=\"text-align: left\"><strong>fgetss() :<\/strong>\u00a0 fgetss() method can read the HTML content in a file and will give the simple text as an output.<\/p>\n<p style=\"text-align: left\"><img decoding=\"async\" class=\"alignnone size-full wp-image-148469\" src=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2018\/10\/fgetss.png\" alt=\"\" width=\"494\" height=\"154\" srcset=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2018\/10\/fgetss.png 494w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2018\/10\/fgetss-250x78.png 250w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2018\/10\/fgetss-300x94.png 300w\" sizes=\"(max-width: 494px) 100vw, 494px\" loading=\"lazy\" \/><\/p>\n<p style=\"text-align: left\"><strong>demo.txt<\/strong><\/p>\n<p style=\"text-align: left\"><img decoding=\"async\" class=\"alignnone size-full wp-image-148470\" src=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2018\/10\/demofile.png\" alt=\"\" width=\"1067\" height=\"219\" srcset=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2018\/10\/demofile.png 1067w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2018\/10\/demofile-250x51.png 250w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2018\/10\/demofile-300x62.png 300w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2018\/10\/demofile-768x158.png 768w\" sizes=\"(max-width: 1067px) 100vw, 1067px\" loading=\"lazy\" \/><\/p>\n<p style=\"text-align: left\">The three of the methods will give the same output as shown below :<\/p>\n<h2 style=\"text-align: left\"><img decoding=\"async\" class=\"alignnone size-full wp-image-148467\" src=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2018\/10\/fileread.png\" alt=\"\" width=\"1322\" height=\"155\" srcset=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2018\/10\/fileread.png 1322w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2018\/10\/fileread-250x29.png 250w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2018\/10\/fileread-300x35.png 300w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2018\/10\/fileread-768x90.png 768w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2018\/10\/fileread-1200x141.png 1200w\" sizes=\"(max-width: 1322px) 100vw, 1322px\" loading=\"lazy\" \/><\/h2>\n<h2 style=\"text-align: left\">Methods Other Than The PHP File Handling<\/h2>\n<p>There are various methods other than the traditional PHP\u00a0file handling that we can use\u00a0for different requirements.<\/p>\n<p><strong>file_get_contents() : <\/strong>We do not need to open or close a file to read. It returns the file in a string, starting at the specified offset to maxlen bytes. On failure,\u00a0<span class=\"function\"><strong>file_get_contents()<\/strong><\/span>\u00a0will return <strong>false<\/strong>. With this method, we can read the file located on the other server by giving the path to the server.<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-148475\" src=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2018\/10\/getcontent-1.png\" alt=\"\" width=\"502\" height=\"117\" srcset=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2018\/10\/getcontent-1.png 502w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2018\/10\/getcontent-1-250x58.png 250w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2018\/10\/getcontent-1-300x70.png 300w\" sizes=\"(max-width: 502px) 100vw, 502px\" loading=\"lazy\" \/><\/p>\n<p><strong>readfile(<\/strong>)<strong>\u00a0:\u00a0<\/strong>The method reads a file and writes it to the output buffer. It returns the number of bytes read from the file. If an error occurs, false\u00a0is returned and unless the function was called as <strong>@<\/strong><span class=\"function\"><strong>readfile()<\/strong><\/span>, an error message is printed. In PHP <strong>@<\/strong> is used to ignore the warnings, so that we can proceed further.<\/p>\n<p>When we try to open the wrong file with readfile().<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-148489\" src=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2018\/10\/fileread-1.png\" alt=\"\" width=\"364\" height=\"130\" srcset=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2018\/10\/fileread-1.png 364w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2018\/10\/fileread-1-250x89.png 250w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2018\/10\/fileread-1-300x107.png 300w\" sizes=\"(max-width: 364px) 100vw, 364px\" loading=\"lazy\" \/><\/p>\n<p>The output for this will be :<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-148479\" src=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2018\/10\/error-output2.png\" alt=\"\" width=\"506\" height=\"79\" srcset=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2018\/10\/error-output2.png 506w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2018\/10\/error-output2-250x39.png 250w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2018\/10\/error-output2-300x47.png 300w\" sizes=\"(max-width: 506px) 100vw, 506px\" loading=\"lazy\" \/><\/p>\n<p>When we try to open the wrong file and use @readfile() instead\u00a0of readfile().<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-148480\" src=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2018\/10\/error_readfile.png\" alt=\"\" width=\"343\" height=\"132\" srcset=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2018\/10\/error_readfile.png 343w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2018\/10\/error_readfile-250x96.png 250w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2018\/10\/error_readfile-300x115.png 300w\" sizes=\"(max-width: 343px) 100vw, 343px\" loading=\"lazy\" \/><\/p>\n<p>The output for this will be :<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-148481\" src=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2018\/10\/error-output.png\" alt=\"\" width=\"514\" height=\"76\" srcset=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2018\/10\/error-output.png 514w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2018\/10\/error-output-250x37.png 250w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2018\/10\/error-output-300x44.png 300w\" sizes=\"(max-width: 514px) 100vw, 514px\" loading=\"lazy\" \/><\/p>\n<p>These are the methods that we can use to read the files.<\/p>\n<p>Hope You Like this Article!<\/p>\n<p>Let us know in below comment box. You can also drop a mail at\u00a0<strong>support@webkul.com<\/strong>\u00a0.<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In PHP there are many ways to read a file. There is a traditional file handling to read\/write a file and various different methods to get the file content. In this article, we will explain the functionality and output of different methods used to read the file. PHP File Handling Methods : In file handling, <a href=\"https:\/\/webkul.com\/blog\/php-file-reading-methods\/\">[&#8230;]<\/a><\/p>\n","protected":false},"author":221,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2383,13],"tags":[],"class_list":["post-148223","post","type-post","status-publish","format-standard","hentry","category-blog","category-php"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>PHP File Reading Methods - Webkul Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/webkul.com\/blog\/php-file-reading-methods\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"PHP File Reading Methods - Webkul Blog\" \/>\n<meta property=\"og:description\" content=\"In PHP there are many ways to read a file. There is a traditional file handling to read\/write a file and various different methods to get the file content. In this article, we will explain the functionality and output of different methods used to read the file. PHP File Handling Methods : In file handling, [...]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/webkul.com\/blog\/php-file-reading-methods\/\" \/>\n<meta property=\"og:site_name\" content=\"Webkul Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/webkul\/\" \/>\n<meta property=\"article:published_time\" content=\"2018-10-22T04:55:49+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2018-10-23T04:26:54+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2018\/10\/fgets-1.png\" \/>\n<meta name=\"author\" content=\"Sweta Som\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@webkul\" \/>\n<meta name=\"twitter:site\" content=\"@webkul\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Sweta Som\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/webkul.com\/blog\/php-file-reading-methods\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/webkul.com\/blog\/php-file-reading-methods\/\"},\"author\":{\"name\":\"Sweta Som\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/fdc8428281225cfb70eb43d6cd066362\"},\"headline\":\"PHP File Reading Methods\",\"datePublished\":\"2018-10-22T04:55:49+00:00\",\"dateModified\":\"2018-10-23T04:26:54+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/webkul.com\/blog\/php-file-reading-methods\/\"},\"wordCount\":395,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/webkul.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/webkul.com\/blog\/php-file-reading-methods\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2018\/10\/fgets-1.png\",\"articleSection\":[\"blog\",\"php\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/webkul.com\/blog\/php-file-reading-methods\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/webkul.com\/blog\/php-file-reading-methods\/\",\"url\":\"https:\/\/webkul.com\/blog\/php-file-reading-methods\/\",\"name\":\"PHP File Reading Methods - Webkul Blog\",\"isPartOf\":{\"@id\":\"https:\/\/webkul.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/webkul.com\/blog\/php-file-reading-methods\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/webkul.com\/blog\/php-file-reading-methods\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2018\/10\/fgets-1.png\",\"datePublished\":\"2018-10-22T04:55:49+00:00\",\"dateModified\":\"2018-10-23T04:26:54+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/webkul.com\/blog\/php-file-reading-methods\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/webkul.com\/blog\/php-file-reading-methods\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/php-file-reading-methods\/#primaryimage\",\"url\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2018\/10\/fgets-1.png\",\"contentUrl\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2018\/10\/fgets-1.png\",\"width\":541,\"height\":173},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/webkul.com\/blog\/php-file-reading-methods\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/webkul.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"PHP File Reading Methods\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/webkul.com\/blog\/#website\",\"url\":\"https:\/\/webkul.com\/blog\/\",\"name\":\"Webkul Blog\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/webkul.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/webkul.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/webkul.com\/blog\/#organization\",\"name\":\"WebKul Software Private Limited\",\"url\":\"https:\/\/webkul.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png\",\"contentUrl\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png\",\"width\":380,\"height\":380,\"caption\":\"WebKul Software Private Limited\"},\"image\":{\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/webkul\/\",\"https:\/\/x.com\/webkul\",\"https:\/\/www.instagram.com\/webkul\/\",\"https:\/\/www.linkedin.com\/company\/webkul\",\"https:\/\/www.youtube.com\/user\/webkul\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/fdc8428281225cfb70eb43d6cd066362\",\"name\":\"Sweta Som\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/cea77654a5ab26ecf23e54c00ae634403aa031ca70a870e4bfc716e114f2087e?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Feva.png&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/cea77654a5ab26ecf23e54c00ae634403aa031ca70a870e4bfc716e114f2087e?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Feva.png&r=g\",\"caption\":\"Sweta Som\"},\"url\":\"https:\/\/webkul.com\/blog\/author\/swetasom-oc891\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"PHP File Reading Methods - Webkul Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/webkul.com\/blog\/php-file-reading-methods\/","og_locale":"en_US","og_type":"article","og_title":"PHP File Reading Methods - Webkul Blog","og_description":"In PHP there are many ways to read a file. There is a traditional file handling to read\/write a file and various different methods to get the file content. In this article, we will explain the functionality and output of different methods used to read the file. PHP File Handling Methods : In file handling, [...]","og_url":"https:\/\/webkul.com\/blog\/php-file-reading-methods\/","og_site_name":"Webkul Blog","article_publisher":"https:\/\/www.facebook.com\/webkul\/","article_published_time":"2018-10-22T04:55:49+00:00","article_modified_time":"2018-10-23T04:26:54+00:00","og_image":[{"url":"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2018\/10\/fgets-1.png","type":"","width":"","height":""}],"author":"Sweta Som","twitter_card":"summary_large_image","twitter_creator":"@webkul","twitter_site":"@webkul","twitter_misc":{"Written by":"Sweta Som","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/webkul.com\/blog\/php-file-reading-methods\/#article","isPartOf":{"@id":"https:\/\/webkul.com\/blog\/php-file-reading-methods\/"},"author":{"name":"Sweta Som","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/fdc8428281225cfb70eb43d6cd066362"},"headline":"PHP File Reading Methods","datePublished":"2018-10-22T04:55:49+00:00","dateModified":"2018-10-23T04:26:54+00:00","mainEntityOfPage":{"@id":"https:\/\/webkul.com\/blog\/php-file-reading-methods\/"},"wordCount":395,"commentCount":0,"publisher":{"@id":"https:\/\/webkul.com\/blog\/#organization"},"image":{"@id":"https:\/\/webkul.com\/blog\/php-file-reading-methods\/#primaryimage"},"thumbnailUrl":"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2018\/10\/fgets-1.png","articleSection":["blog","php"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/webkul.com\/blog\/php-file-reading-methods\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/webkul.com\/blog\/php-file-reading-methods\/","url":"https:\/\/webkul.com\/blog\/php-file-reading-methods\/","name":"PHP File Reading Methods - Webkul Blog","isPartOf":{"@id":"https:\/\/webkul.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/webkul.com\/blog\/php-file-reading-methods\/#primaryimage"},"image":{"@id":"https:\/\/webkul.com\/blog\/php-file-reading-methods\/#primaryimage"},"thumbnailUrl":"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2018\/10\/fgets-1.png","datePublished":"2018-10-22T04:55:49+00:00","dateModified":"2018-10-23T04:26:54+00:00","breadcrumb":{"@id":"https:\/\/webkul.com\/blog\/php-file-reading-methods\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/webkul.com\/blog\/php-file-reading-methods\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/php-file-reading-methods\/#primaryimage","url":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2018\/10\/fgets-1.png","contentUrl":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2018\/10\/fgets-1.png","width":541,"height":173},{"@type":"BreadcrumbList","@id":"https:\/\/webkul.com\/blog\/php-file-reading-methods\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/webkul.com\/blog\/"},{"@type":"ListItem","position":2,"name":"PHP File Reading Methods"}]},{"@type":"WebSite","@id":"https:\/\/webkul.com\/blog\/#website","url":"https:\/\/webkul.com\/blog\/","name":"Webkul Blog","description":"","publisher":{"@id":"https:\/\/webkul.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/webkul.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/webkul.com\/blog\/#organization","name":"WebKul Software Private Limited","url":"https:\/\/webkul.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png","contentUrl":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png","width":380,"height":380,"caption":"WebKul Software Private Limited"},"image":{"@id":"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/webkul\/","https:\/\/x.com\/webkul","https:\/\/www.instagram.com\/webkul\/","https:\/\/www.linkedin.com\/company\/webkul","https:\/\/www.youtube.com\/user\/webkul\/"]},{"@type":"Person","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/fdc8428281225cfb70eb43d6cd066362","name":"Sweta Som","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/cea77654a5ab26ecf23e54c00ae634403aa031ca70a870e4bfc716e114f2087e?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Feva.png&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/cea77654a5ab26ecf23e54c00ae634403aa031ca70a870e4bfc716e114f2087e?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Feva.png&r=g","caption":"Sweta Som"},"url":"https:\/\/webkul.com\/blog\/author\/swetasom-oc891\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/148223","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/users\/221"}],"replies":[{"embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/comments?post=148223"}],"version-history":[{"count":17,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/148223\/revisions"}],"predecessor-version":[{"id":148667,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/148223\/revisions\/148667"}],"wp:attachment":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/media?parent=148223"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/categories?post=148223"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/tags?post=148223"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}