search
HomeBackend DevelopmentPHP ProblemDon't think that you don't need to learn C language to do PHP

Don't think that you don't need to learn C language to do PHP

The reason why I say "Don't think that learning PHP does not require learning C language" is because you only learn PHP without any basic languages ​​​​such as C language. It is difficult to deeply understand many things in PHP without the support.

There are actually many such examples. Here I will give you this example: the difference and connection between PHP arrays and C language arrays.

Friends who have studied C language certainly know that there are arrays in C language;

There are also arrays in PHP, but their functions are almost completely different. PHP has too many arrays and is very easy to use. function. So what's the reason? Are there many kinds of arrays and you just learn one of them? Actually not.

The fundamental reason is: the array in C language is a real array, which is a continuous storage space applied for on the stack. Once this kind of space is applied for, you cannot add an element or delete an element. It can only be operated as a whole, either delete it all, or re-apply for an array. This is a real array.

The array in PHP is actually not such an array. It applies for memory in the heap, then uses a pointer to point to the head address, and then traverses the pointer, so that a certain element can be deleted and a new one can be added at any time. elements, because it is no longer a real array in nature, but a linked list.

So it can be seen from here that C language is of great significance to the understanding and learning of PHP. Without the linked list support of C language, the features of PHP will appear inexplicably, and you will always feel that you have no place to stand despite your fantasies.

The linked list principle in C language is the principle basis for realizing vector, list, map, and other dynamic arrays, linked lists, sets, and queues in C. It is also the principle basis for realizing arrays in PHP (essentially dynamic arrays implemented by linked lists). ) principle basis.

Then the understanding of the complex data structures of the upper-layer language will become logical. The operations on PHP arrays become easy to understand. For example:

Insert an element at the end:

Dont think that you dont need to learn C language to do PHP

Dont think that you dont need to learn C language to do PHP

##Pop up an element:


Dont think that you dont need to learn C language to do PHP

Dont think that you dont need to learn C language to do PHP

#These things are very comfortable to use and will not pop up a scary black window error message for you, but behind the comfort, you need a foundation to support it. It's its business to sacrifice compilation performance, but it's your business to understand it. If you can't understand it, you can only memorize it, which will be uncomfortable because it will be easy to forget.

How to avoid forgetting easily is to understand it, its origin, and the principles of its feasibility.... Only then will everything go naturally. No one stipulates that if you want to learn it, you have to learn it very painfully.

Knowing it but not knowing why is the biggest obstacle to success in learning and the biggest factor in learning bottlenecks.

So the significance of C language is to have an easier understanding of upper-level languages. Upper-level languages ​​such as PHP are not used to learn linked lists, but to use linked lists. So using PHP to write a linked list actually doesn't make much sense.

That's just an "academic show off" for beginners who have little experience. Because even pointers are hidden in PHP, how can we have a deep understanding of linked lists? It’s no wonder that those who learn C look down on those who learn C, and those who learn C look down on those who learn PHP; the difficulty is different. In the eyes of programmers with profound internal skills, many so-called experienced people are actually doing things to "grandstand", I guess. The feeling that it doesn't matter as long as it can fool beginners.

You must be good at associating in order to reduce the burden of learning. Only by paying attention to your learning mood can you achieve long-term results. Being good at understanding still requires a certain amount of strength, breadth and depth to support it.

So, don’t think that learning PHP means you don’t have to learn C language. Otherwise, it will be difficult for you to understand many things in PHP. Without a foundation, you can only rely on fantasy and recitation, and it will be difficult to learn deeply and for a long time. Because it is too tiring... At the same time, learning C language does not mean that you have passed the test after reading and learning it. The key is to know and understand it.

For example, can you explain what a linked list is to a person who doesn't understand computers? What are the characteristics, how to implement it, etc. How much you can say shows how much you know.

If you want to know more related issues, please visit the PHP Chinese website:

PHP Video Tutorial

The above is the detailed content of Don't think that you don't need to learn C language to do PHP. For more information, please follow other related articles on the PHP Chinese website!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
ACID vs BASE Database: Differences and when to use each.ACID vs BASE Database: Differences and when to use each.Mar 26, 2025 pm 04:19 PM

The article compares ACID and BASE database models, detailing their characteristics and appropriate use cases. ACID prioritizes data integrity and consistency, suitable for financial and e-commerce applications, while BASE focuses on availability and

PHP Secure File Uploads: Preventing file-related vulnerabilities.PHP Secure File Uploads: Preventing file-related vulnerabilities.Mar 26, 2025 pm 04:18 PM

The article discusses securing PHP file uploads to prevent vulnerabilities like code injection. It focuses on file type validation, secure storage, and error handling to enhance application security.

PHP Input Validation: Best practices.PHP Input Validation: Best practices.Mar 26, 2025 pm 04:17 PM

Article discusses best practices for PHP input validation to enhance security, focusing on techniques like using built-in functions, whitelist approach, and server-side validation.

PHP API Rate Limiting: Implementation strategies.PHP API Rate Limiting: Implementation strategies.Mar 26, 2025 pm 04:16 PM

The article discusses strategies for implementing API rate limiting in PHP, including algorithms like Token Bucket and Leaky Bucket, and using libraries like symfony/rate-limiter. It also covers monitoring, dynamically adjusting rate limits, and hand

PHP Password Hashing: password_hash and password_verify.PHP Password Hashing: password_hash and password_verify.Mar 26, 2025 pm 04:15 PM

The article discusses the benefits of using password_hash and password_verify in PHP for securing passwords. The main argument is that these functions enhance password protection through automatic salt generation, strong hashing algorithms, and secur

OWASP Top 10 PHP: Describe and mitigate common vulnerabilities.OWASP Top 10 PHP: Describe and mitigate common vulnerabilities.Mar 26, 2025 pm 04:13 PM

The article discusses OWASP Top 10 vulnerabilities in PHP and mitigation strategies. Key issues include injection, broken authentication, and XSS, with recommended tools for monitoring and securing PHP applications.

PHP XSS Prevention: How to protect against XSS.PHP XSS Prevention: How to protect against XSS.Mar 26, 2025 pm 04:12 PM

The article discusses strategies to prevent XSS attacks in PHP, focusing on input sanitization, output encoding, and using security-enhancing libraries and frameworks.

PHP Interface vs Abstract Class: When to use each.PHP Interface vs Abstract Class: When to use each.Mar 26, 2025 pm 04:11 PM

The article discusses the use of interfaces and abstract classes in PHP, focusing on when to use each. Interfaces define a contract without implementation, suitable for unrelated classes and multiple inheritance. Abstract classes provide common funct

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
1 months agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool