Monday, June 29, 2020

How to Read a File In PHP

There are two ways to read whole content of a file in PHP language. First way is to use the function fread() with the function filesize(). The second way is to use the function file_get_content().

Examples

The following code shows how to use the first method.
$path = "C:\Users\XUser\documents\my-file.txt";
$stream = fopen($path, 'r');
$wholeContent = fread($stream, filesize($path));
fclose($stream);

The following code shows how to use the first method.
$path = "C:\Users\XUser\documents\my-file.txt";
$stream = file_get_content($path);

As for me, I recomend the second way over the first one. Because in some cases, I have seen that the first way does not read the whole file. In addition, it is easier to understand than the first one

Wednesday, June 24, 2020

How to Delete a Tag From GitHub Using GitHub Desktop

Very simple. All what you have to do is the following:
1- Open command line by opening the menu "Repository > Open in Command Prompt".
2- Execute the following command: "git push origin :<TAG_NAM>.
3- If it asks you to login, enter your credentials.
4- The tag will be removed and a message in the terminal that says the tag is removed will appear.