博客园 - 非著名程序师uuid:7d267088-5232-4821-9010-8cd5fdd6cd4f;id=10729132020-08-29T14:04:52Z非著名程序师https://www.cnblogs.com/fanchangfa/feed.cnblogs.comhttps://www.cnblogs.com/fanchangfa/p/4345162.htmlPHP匿名函数(闭包) - 非著名程序师匿名函数(Anonymous functions),也叫闭包函数(closures),允许 临时创建一个没有指定名称的函数。最经常用作回调函数(callback)参数的值。当然,也有其它应用的情况。结合array_walk和匿名函数来实现一个结算功能array_walk() 函数对数组中的每个元素应...2015-03-17T10:35:00Z2015-03-17T10:35:00Z非著名程序师https://www.cnblogs.com/fanchangfa/【摘要】匿名函数(Anonymous functions),也叫闭包函数(closures),允许 临时创建一个没有指定名称的函数。最经常用作回调函数(callback)参数的值。当然,也有其它应用的情况。结合array_walk和匿名函数来实现一个结算功能array_walk() 函数对数组中的每个元素应... <a href="https://www.cnblogs.com/fanchangfa/p/4345162.html" target="_blank">阅读全文</a>https://www.cnblogs.com/fanchangfa/p/4325451.htmlPHP进阶知识总结 - 非著名程序师周末梳理了下这段时间看书的一些知识点,进步的过程不仅要实践,还要安排多看书、思考、总结。只针对知识点进行了罗列和简单说明,很多细节还未整理好,待后面再专门详细写。基础易忽略概念PHP是一个支持面向对象开发的语言,而不是一个纯面向对象的语言PHP5中保留了对var的支持,但会将var自动转换为publ...2015-03-10T03:17:00Z2015-03-10T03:17:00Z非著名程序师https://www.cnblogs.com/fanchangfa/【摘要】周末梳理了下这段时间看书的一些知识点,进步的过程不仅要实践,还要安排多看书、思考、总结。只针对知识点进行了罗列和简单说明,很多细节还未整理好,待后面再专门详细写。基础易忽略概念PHP是一个支持面向对象开发的语言,而不是一个纯面向对象的语言PHP5中保留了对var的支持,但会将var自动转换为publ... <a href="https://www.cnblogs.com/fanchangfa/p/4325451.html" target="_blank">阅读全文</a>https://www.cnblogs.com/fanchangfa/p/4185239.htmlPHP的内存泄露问题与垃圾回收 - 非著名程序师你写了一个PHP脚本,一般都不用考虑内存泄露和垃圾回收的问题,因为一般情况下你的脚本很快就执行完退出了。但在一些运行时间长,数据量大的时候,程序运行一段时间后,php脚本就占用了过多内存,然后就报错(PHP Fatal error: Allowed memory size of 134217728 ...2014-12-25T09:58:00Z2014-12-25T09:58:00Z非著名程序师https://www.cnblogs.com/fanchangfa/【摘要】你写了一个PHP脚本,一般都不用考虑内存泄露和垃圾回收的问题,因为一般情况下你的脚本很快就执行完退出了。但在一些运行时间长,数据量大的时候,程序运行一段时间后,php脚本就占用了过多内存,然后就报错(PHP Fatal error: Allowed memory size of 134217728 ... <a href="https://www.cnblogs.com/fanchangfa/p/4185239.html" target="_blank">阅读全文</a>https://www.cnblogs.com/fanchangfa/p/4185177.htmlphp中http_build_query函数 - 非著名程序师http_build_query(array$formdata[,string$numeric_prefix] )使用给出的关联(或下标)数组生成一个经过 URL-encode 的请求字符串。参数formdata可以是数组或包含属性的对象。一个formdata数组可以是简单的一维结构,也可以是由数组...2014-12-25T09:37:00Z2014-12-25T09:37:00Z非著名程序师https://www.cnblogs.com/fanchangfa/【摘要】http_build_query(array$formdata[,string$numeric_prefix] )使用给出的关联(或下标)数组生成一个经过 URL-encode 的请求字符串。参数formdata可以是数组或包含属性的对象。一个formdata数组可以是简单的一维结构,也可以是由数组... <a href="https://www.cnblogs.com/fanchangfa/p/4185177.html" target="_blank">阅读全文</a>https://www.cnblogs.com/fanchangfa/p/4185163.html【转】怎么用PHP发送HTTP请求(POST请求、GET请求)? - 非著名程序师file_get_contents版本: 1 /** 2 * 发送post请求 3 * @param string $url 请求地址 4 * @param array $post_data post键值对数据 5 * @return string 6 */ 7 function send...2014-12-25T09:32:00Z2014-12-25T09:32:00Z非著名程序师https://www.cnblogs.com/fanchangfa/【摘要】file_get_contents版本: 1 /** 2 * 发送post请求 3 * @param string $url 请求地址 4 * @param array $post_data post键值对数据 5 * @return string 6 */ 7 function send... <a href="https://www.cnblogs.com/fanchangfa/p/4185163.html" target="_blank">阅读全文</a>https://www.cnblogs.com/fanchangfa/p/4158046.htmlphp面向对象的简单总结 $this $parent self - 非著名程序师虽然接触php比较长时间,但有时在使用一些基础东西的时候还会有些不确定,有些疑惑。面向对象涉及到的比较多,大概总结整理一下php的属性、对象,以及访问方式$this $parent self 的使用场景。1. PHP类属性定义和访问方式: 1 tConst; //无错误,无输出 9 ...2014-12-11T10:18:00Z2014-12-11T10:18:00Z非著名程序师https://www.cnblogs.com/fanchangfa/【摘要】虽然接触php比较长时间,但有时在使用一些基础东西的时候还会有些不确定,有些疑惑。面向对象涉及到的比较多,大概总结整理一下php的属性、对象,以及访问方式$this $parent self 的使用场景。1. PHP类属性定义和访问方式: 1 tConst; //无错误,无输出 9 ... <a href="https://www.cnblogs.com/fanchangfa/p/4158046.html" target="_blank">阅读全文</a>https://www.cnblogs.com/fanchangfa/p/4156138.html【转】PHP如何快速读取大文件 - 非著名程序师在PHP中,对于文件的读取时,最快捷的方式莫过于使用一些诸如file、file_get_contents之类的函数,简简单单的几行代码就能 很漂亮的完成我们所需要的功能。但当所操作的文件是一个比较大的文件时,这些函数可能就显的力不从心, 下面将从一个需求入手来说明对于读取大文件时,常用的操作方法。需...2014-12-10T11:18:00Z2014-12-10T11:18:00Z非著名程序师https://www.cnblogs.com/fanchangfa/【摘要】在PHP中,对于文件的读取时,最快捷的方式莫过于使用一些诸如file、file_get_contents之类的函数,简简单单的几行代码就能 很漂亮的完成我们所需要的功能。但当所操作的文件是一个比较大的文件时,这些函数可能就显的力不从心, 下面将从一个需求入手来说明对于读取大文件时,常用的操作方法。需... <a href="https://www.cnblogs.com/fanchangfa/p/4156138.html" target="_blank">阅读全文</a>https://www.cnblogs.com/fanchangfa/p/4155274.htmlPHP array_flip() array_merge() array+array的使用总结 - 非著名程序师array_flip(array);//传递一个数组参数,对该数组的键、值进行翻转例如:$a = array( 'a', 'b', 'c');print_r(array_flip($a));//输出为:Array( [a] => 0 [b] => 1 [c] =>...2014-12-10T05:50:00Z2014-12-10T05:50:00Z非著名程序师https://www.cnblogs.com/fanchangfa/【摘要】array_flip(array);//传递一个数组参数,对该数组的键、值进行翻转例如:$a = array( 'a', 'b', 'c');print_r(array_flip($a));//输出为:Array( [a] => 0 [b] => 1 [c] =>... <a href="https://www.cnblogs.com/fanchangfa/p/4155274.html" target="_blank">阅读全文</a>https://www.cnblogs.com/fanchangfa/p/4059083.htmlMaximum Subarray 连续子数组最大和 - 非著名程序师Find the contiguous subarray within an array (containing at least one number) which has the largest sum.For example, given the array[−2,1,−3,4,−1,2,1,...2014-10-29T03:44:00Z2014-10-29T03:44:00Z非著名程序师https://www.cnblogs.com/fanchangfa/【摘要】Find the contiguous subarray within an array (containing at least one number) which has the largest sum.For example, given the array[−2,1,−3,4,−1,2,1,... <a href="https://www.cnblogs.com/fanchangfa/p/4059083.html" target="_blank">阅读全文</a>https://www.cnblogs.com/fanchangfa/p/4059079.htmlClimbing Stairs 爬楼梯问题,每次可以走1或2步,爬上n层楼梯总方法 (变相fibonacci) - 非著名程序师You are climbing a stair case. It takesnsteps to reach to the top.Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb...2014-10-29T03:42:00Z2014-10-29T03:42:00Z非著名程序师https://www.cnblogs.com/fanchangfa/【摘要】You are climbing a stair case. It takesnsteps to reach to the top.Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb... <a href="https://www.cnblogs.com/fanchangfa/p/4059079.html" target="_blank">阅读全文</a>https://www.cnblogs.com/fanchangfa/p/4059057.htmlSearch Insert Position 查找给定元素在数组中的位置,若没有则返回应该在的位置 - 非著名程序师Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in or...2014-10-29T03:35:00Z2014-10-29T03:35:00Z非著名程序师https://www.cnblogs.com/fanchangfa/【摘要】Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in or... <a href="https://www.cnblogs.com/fanchangfa/p/4059057.html" target="_blank">阅读全文</a>https://www.cnblogs.com/fanchangfa/p/4058229.htmlRemove Duplicates from Sorted List 去除链表中重复值节点 - 非著名程序师Given a sorted linked list, delete all duplicates such that each element appear only once. For example,Given 1->1->2, return 1->2.Given 1->1->2->3->3,2014-10-28T15:02:00Z2014-10-28T15:02:00Z非著名程序师https://www.cnblogs.com/fanchangfa/【摘要】Given a sorted linked list, delete all duplicates such that each element appear only once. For example,Given 1->1->2, return 1->2.Given 1->1->2->3->3, <a href="https://www.cnblogs.com/fanchangfa/p/4058229.html" target="_blank">阅读全文</a>https://www.cnblogs.com/fanchangfa/p/4041668.htmlPopulating Next Right Pointers in Each Node 设置二叉树的next节点 - 非著名程序师Given a binary tree struct TreeLinkNode { TreeLinkNode *left; TreeLinkNode *right; TreeLinkNode *next; }Populate each next pointe...2014-10-21T13:53:00Z2014-10-21T13:53:00Z非著名程序师https://www.cnblogs.com/fanchangfa/【摘要】Given a binary tree struct TreeLinkNode { TreeLinkNode *left; TreeLinkNode *right; TreeLinkNode *next; }Populate each next pointe... <a href="https://www.cnblogs.com/fanchangfa/p/4041668.html" target="_blank">阅读全文</a>https://www.cnblogs.com/fanchangfa/p/4041649.htmlBinary Tree Inorder/Preorder Traversal 返回中序和前序/遍历二叉树的元素集合 - 非著名程序师给定一个二叉树,以集合方式返回其中序/先序方式遍历的所有元素。有两种方法,一种是经典的中序/先序方式的经典递归方式,另一种可以结合栈来实现非递归Given a binary tree, return theinordertraversal of its nodes' values.For examp...2014-10-21T13:44:00Z2014-10-21T13:44:00Z非著名程序师https://www.cnblogs.com/fanchangfa/【摘要】给定一个二叉树,以集合方式返回其中序/先序方式遍历的所有元素。有两种方法,一种是经典的中序/先序方式的经典递归方式,另一种可以结合栈来实现非递归Given a binary tree, return theinordertraversal of its nodes' values.For examp... <a href="https://www.cnblogs.com/fanchangfa/p/4041649.html" target="_blank">阅读全文</a>https://www.cnblogs.com/fanchangfa/p/4041635.htmlSame Tree 比较两个二叉树是否完全相同 - 非著名程序师Given two binarytrees, write a function to check if they are equal or not.Two binary trees are considered equal if they are structurally identical and...2014-10-21T13:37:00Z2014-10-21T13:37:00Z非著名程序师https://www.cnblogs.com/fanchangfa/【摘要】Given two binarytrees, write a function to check if they are equal or not.Two binary trees are considered equal if they are structurally identical and... <a href="https://www.cnblogs.com/fanchangfa/p/4041635.html" target="_blank">阅读全文</a>https://www.cnblogs.com/fanchangfa/p/4041629.htmlLinked List Cycle 判断一个链表是否存在回路(循环) - 非著名程序师Given a linked list, determine if it has a cycle in it.Follow up:Can you solve it without using extra space?注意,链表循环并不是尾指针和头指针相同,可能是在中间某一段形成一个环路,所以不能只判...2014-10-21T13:35:00Z2014-10-21T13:35:00Z非著名程序师https://www.cnblogs.com/fanchangfa/【摘要】Given a linked list, determine if it has a cycle in it.Follow up:Can you solve it without using extra space?注意,链表循环并不是尾指针和头指针相同,可能是在中间某一段形成一个环路,所以不能只判... <a href="https://www.cnblogs.com/fanchangfa/p/4041629.html" target="_blank">阅读全文</a>https://www.cnblogs.com/fanchangfa/p/4041621.htmlReverse Integer 旋转数字 - 非著名程序师Reverse digits of an integer.Example1:x = 123, return 321Example2:x = -123, return -321本地注意正负号判断比较关键,实现部分可能不是最优的,按照自己的想法实现:设ret = 1;每次对x进行取余mod,然后ret ...2014-10-21T13:31:00Z2014-10-21T13:31:00Z非著名程序师https://www.cnblogs.com/fanchangfa/【摘要】Reverse digits of an integer.Example1:x = 123, return 321Example2:x = -123, return -321本地注意正负号判断比较关键,实现部分可能不是最优的,按照自己的想法实现:设ret = 1;每次对x进行取余mod,然后ret ... <a href="https://www.cnblogs.com/fanchangfa/p/4041621.html" target="_blank">阅读全文</a>https://www.cnblogs.com/fanchangfa/p/4041612.htmlMaximum Depth of Binary Tree 二叉树的深度 - 非著名程序师Given a binary tree,find its maximum depth.The maximum depth is the number of nodes along the longest path from the root node down to the farthest lea...2014-10-21T13:25:00Z2014-10-21T13:25:00Z非著名程序师https://www.cnblogs.com/fanchangfa/【摘要】Given a binary tree,find its maximum depth.The maximum depth is the number of nodes along the longest path from the root node down to the farthest lea... <a href="https://www.cnblogs.com/fanchangfa/p/4041612.html" target="_blank">阅读全文</a>https://www.cnblogs.com/fanchangfa/p/4041606.htmlSingle Number 数组中除了某个元素出现一次,其他都出现两次,找出这个元素 - 非著名程序师Given an array of integers, every element appearstwiceexcept for one. Find that single one.Note:Your algorithm should have a linear runtime complexity...2014-10-21T13:22:00Z2014-10-21T13:22:00Z非著名程序师https://www.cnblogs.com/fanchangfa/【摘要】Given an array of integers, every element appearstwiceexcept for one. Find that single one.Note:Your algorithm should have a linear runtime complexity... <a href="https://www.cnblogs.com/fanchangfa/p/4041606.html" target="_blank">阅读全文</a>https://www.cnblogs.com/fanchangfa/p/4041567.htmlMaximum Product Subarray 最大连续乘积子集 - 非著名程序师Find the contiguous subarray within an array (containing at least one number) which has the largest product.For example, given the array[2,3,-2,4],the...2014-10-21T13:07:00Z2014-10-21T13:07:00Z非著名程序师https://www.cnblogs.com/fanchangfa/【摘要】Find the contiguous subarray within an array (containing at least one number) which has the largest product.For example, given the array[2,3,-2,4],the... <a href="https://www.cnblogs.com/fanchangfa/p/4041567.html" target="_blank">阅读全文</a>