Posts in November 2023

[PHP] Improving var_dump Readability by Adding Color and Line Breaks

crear var_dump

This article aims to address the issue of the often hard-to-read output of the frequently used PHP var_dump function by enhancing its readability through the addition of color and line breaks. Goal of this article When working with PHP, we often use var_dump to inspect variable contents.However, the default var_dump output can be challenging to […]

[PHP] How to Count Number of Lines in File

In this article, we will explain how to count the number of lines in file using PHP. We will also discuss methods for counting the lines in all loaded files. Counting the number of lines in an individual file By passing a file path to the file function, it returns each line as an array. […]

[PHP] How to Generate Dynamic Table of Contents

table of contents

In this article, we will describe about how to automatically generate Table of Contents from headings using PHP.Our method also supports multiple levels of headings. Goal of this article We aim to automatically generate a table of contents from headings using PHP, assuming the presence of HTML as below.The table of contents will be inserted just before […]

[Javascript] How to Make a Table of Contents Automatically

table of contents

In this article, we will describe about how to automatically generate a Table of Contents (toc) from headings using Javascript.Our method also supports multiple levels of headings. Table of Contents from Headings We aim to automatically generate a table of contents from headings, assuming the presence of HTML as below. The table of contents will […]

[Javascript]How to write One-Time EventListener

In modern major browsers, you don’t need removeEventListener or flags to execute an event only once in JavaScript.There’s a fantastic option available, so let’s take a closer look. addEventListener Once Just by adding {once: true} to the third argument for addEventListener, it will execute the event only once. Wonderful! In the case of jQuery In […]

[Javascript]How to convert HTML string into Node

In this article, we will discuss how to convert HTML string into Nodes. Converting HTML string to Node This can be very simple, and you can define the function in just one line. The following information is supplementary. DOM operations on the converted Node The Node converted using the previous method is formally known as […]

[Javascript]How to detect if the Event is triggered by user’s action

In this article, we will discuss about how to detect whether an event is triggered by actual user’s actions or forced triggering by a script. In the case of plain Javascript By referencing the isTrusted property of the event object passed to the event listener’s callback, you can determine whether the event was triggered by […]