Again, thanks so much for joining us this morning. Let me introduce the panelists first before we jump right into today's topic. First of all, Maria Ramos, who is the Chief Executive Officer of Barclays Africa. She spends most of her time on the continent and in Johannesburg, and comes with a very long experience, both in macroeconomics from government, as well as the private sector and business. We've got Rehman McGuire, who is head of global banking at the city, comes from New York today, if I understand correctly. And I think we'll be a great addition in putting Africa on the global map and where it stands compared to other regions that are doing just as well or even better. To my right is the Honorable Central Bank Governor of Rwanda, Governor of the National Bank of Rwanda, John Rangomwa. Thank you so much for coming from Kigali today. And last but not least, of course, the Bubbly Hendrick Dutoyt, who is the Chief Executive Officer of InvestStack, a South African investment bank that's doing big things across the continent. So just to frame the discussion a little bit, although I'm sure you're all very familiar with what's bothering us all and what's keeping regulators and bankers awake at the moment, is that there's this great feeling that the continent and its individual economies and many corporates within those economies are on the cusp of something really great of really unleashing into the future. And certainly, looking from outside into Africa, there's a lot of talk about that, a lot of talk of Africa rising in fits and starts, but still rising. And one of the key questions and one of the key things that can make that accelerate and grow exponentially or can really arrest that growth is the availability of capital, the access that economies and corporates have to debt as well as equity instruments and deepening and broadening that across the continent, connecting the continent internally, crucially, but also externally to the rest of the world. And those are roughly the issues we'll be discussing today as well as how to regulate that best. I'm sure most here would like a light touch on that, but at least normalized so that there is some predictability in the framework of how capital flows across the continent. And so without further ado, let me start with Maria on some initial thoughts on this question. Well, thank you very much, Martina, and good morning, everyone. I thought I'd just frame it by giving a sense of where we've come from and what has happened over the last decade or so. And I thought I'd look at it from a couple of perspectives. I think economic growth is obviously very important, and there are different ways of thinking about economic growth. And one of those is to think about what's happened with trade flows across the continent for the last decade. So I thought I'd look at trade flows, debt markets, and equity markets, just to give some perspective. And then just pose some ideas of what I think needs to happen as we think about the development of capital markets into the future. So let me put some numbers out there on trade flows. And many of us are very aware of these, but just to give a sense of what's happened. So if you think of the trade front, and this is according to the IMF statistics, African trade grew from around $470 billion in 2005 to just over $1 trillion last year. That's quite significant. Trade with Europe is about 30% of the total. Trade with China has increased fivefold to $162 billion. The trade mix has also changed away from commodities and metals and towards consumer goods and financial services. So there's quite a lot of change going on, and that also gives you a perspective of the importance of changing and developing the financial infrastructure in each of the countries across this continent and the continent as a whole. And often we talk a lot about the investment required, the $75 to $85 billion of investment required in infrastructure. And we talk about that in the form of the investment required in roads, and ports, and railways, and pipelines. But the investment that is required in the development of financial infrastructure is just as important if we were going to make all of this happen. So what has happened in capital markets? And if we just look at debt markets, one of the best indicators of economic growth on the continent has been the upward trend in bond issuances. And in 2014, new issuances came from Zambia, Kenya, Cote d'Ivoire, South Africa, Senegal, Ethiopia, and Ghana. Collectively, these countries raised just over $7 billion, with yields on par with some of the Southern European countries. And if somebody had said to me when I was director general of the Treasury just over 10 years ago that this would happen, I would have said, not likely. Well, it has happened. I think the interesting thing in what a particular perspective, as I certainly have on this, is that this will accelerate over the next 10 years. Also, if we think about this from the perspective of Africa's inclusion in the global EM debt indices, in 2008, there were just five countries included in the dollar index, representing some $5.6 billion of issuance. This has grown to $36 billion with 15 issuers. That's interesting and important. If we look at equity markets, well, across the continent, we have seen the rise of stock markets in many countries. I think one perspective, though, is that since the crisis, activity in these markets has remained relatively muted. That's not everywhere. We've seen, you know, country exceptions in countries like Nigeria, in Kenya, in South Africa. But there's much more that can be done to achieve greater progress. So what are some of the things that can be done? Well, to my mind, we need to see a lot more being done in terms of reform of the domestic pension fund and mutual funds sector. Growth in these sectors, and there are really a number of initiatives through pension reform, changes in tax incentives for savers, can allow and create better markets and deepen the markets. Technology is another area. Trading systems in many of our countries have remained outmoded and somewhat inefficient. And that raises costs, as we all know. And although there's a lot of reform and the way accelerating that reform is very important, countries like Ghana, for example, in 2013, introduced an alternative market to accommodate startups and SMEs. I think we need to see a bit more of that, particularly in a world where we're starting to see technology innovation, a lot more creativity, raising capital for that is going to be important. And governance in the form of making sure that we create a more equal playing field, the rules of the game are better understood so that you can reduce the costs of issuance of listings is going to be really important. Having those are harmonized across countries is going to be important as well. Creating more liquidity in markets, and there are lots of ways of doing this. And one of those is, for example, to allow for in with listings of debt instruments in both local and foreign countries. If you think about a currency, if you think about the non-bank financial institution asset-based in South Africa, it's about 8 and 1 half trillion rand. And you think about the potential in the bank assets are about 5 trillion rand. If you think about the potential of that and the liquidity in that, you begin to get a sense of how much more can actually be done. And then finally, before we open up or we move on and conclude my comments, I think all of this has to be underpinned by sound macroeconomic policies. I guess without that, we're just not going to be able to sustain the development of markets. And we've had a decade of solid sound macroeconomic policies. We saw median deficits come down to around 0.5%. We've seen post the crisis, those deficits increased to around 4%. So I think we're starting to see some buildup of fiscal pressure in some countries. And we need to make sure that that doesn't create macroeconomic instability that can actually hinder the progress and the development of domestic capital markets across the continent. So let me stop there. Yeah, and definitely increase sovereign access to international capital markets is already building debt loads, which the IMF has already said could be something to watch for the future. So it's certainly not something to go into binge on, as we're seeing from the Eurozone anyway. Raymond, where does this fit into what's happening elsewhere? What lessons are there for Africa in other parts of the world? And in the current moment, how does it compare in terms of attractiveness? First, let me say it's an honor to be here with you and the other distinguished panelists. We have been in Africa. We've city have been in Africa for 50 years. We're in 101 countries around the world. We have a presence in Africa in 16 countries. To put this in a global context, as we think about the continent, and we know that there are 55 countries here, as we think about the continent in total relative to what's taking place around the world. From a geoeconomic standpoint, Africa is of the top 15 growth geographies in the world. It's in the top 10. So it is important to a macro, global macro equation. With respect to investment in Africa, the investment dollars today are fixed income dollars. If you think about the issuances that have occurred, you reference some of the country issuances to put this in context. In the year 2000, there were $3.5 billion of capital outstanding in Africa. In 2010, there was $13.5 billion. And in 2014, it was $74 billion worth of capital outstanding. Now, who are the issuers? It's primarily first, it goes sovereigns. So much of that issuance is sovereigns. And then it goes to the financial services industry. As we've seen here, we have over the past two to three years, $2 billion worth of capital issued to the financial services industry, the zeniths, the access banks of the world, where they have accessed the capital markets at $500 plus billion dollars or so. So there's a lot of confidence from primarily European investors because most of the capital that's been raised on the fixed income side is in the Euro bond market. And by the way, given some of the successes that the continent has enjoyed, spreads have come in. So yields have now been much more attractive. We saw the largest issuances in the continent 10 years from Ethiopia, which has been pretty attractive. We've seen some attractive issuances from Kenya, some attractive issuances from Cote d'Ivoire. So there is a confidence in the marketplace notwithstanding some of the headwinds that are out there. When it comes to the equity markets, we've had fewer successes, but some successes. We saw the IPO of Seplot, which is a successful IPO that took place on the African exchanges, on the London exchanges. So as I step back and look at the continent, there is a view that as you think about macro growth, that it will be facilitated in large part what takes place here. There are clearly headwinds. But the view is that as you think about the future and you think about where growth is going to be engineered, it comes from the continent. We'll, I imagine, talk later about some of the headwinds. But we have a lot of confidence in what's taking place here. We think that the infrastructure is developing, such that we can facilitate capital flows outside of just the fixed income capital flows. If you think about what's important to the development of these markets, you have to have both a balance of equity and a balance of fixed income. At some point, I imagine we'll talk about the size of the exchanges relative to GDP. In the developed markets, you have multiples of the debt and equity markets over GDP of two times. In the emerging markets, you have equity and debt to GDP of less than one time. So there's clear upside to the development of the capital markets. We'll talk about some of the principles that are necessary for that development. But there's clear upside here. Again, the headwinds, which we will potentially address, but we think that as a growth geography, it's an important and vital growth geography. Thanks. And John, I mean, from a regulator's perspective, because we talk a lot about putting in this vital infrastructure, where does a central bank come in? And what's the idea behind normalizing that, at least on a regional level, just to make things a little simpler and a little less confusing? Yeah, thank you. I think, building on what my colleagues have already said, we are in a better position today as Africa to talk of developing our capital markets compared to where we were 10 years ago. I think that the biggest prerequisite for any development of a capital market is economic stability. And as Maria said, I think this has been great achieved over the last 10 years. Today, we have averaging inflation of around 6% for quite some time for many countries, and even others below 5%. So the issues of hyperinflation in Africa would say in many countries is history. So that gives confidence to investors and to development of financial products. And as talking about regulation, one other big achievement you see across African countries is opening up our markets. It's opening up our capital accounts. There are few countries still have controls over flow of capital in and out. So that allows us to attract foreign investment to our continent. The other important factor is maybe linked to our region in East Africa is working to integrate our markets because we realize that the key limiting factor to this development of our markets is the depth of the markets on individual country basis. The liquidity is not enough. The products on the market are not enough to drive really the growth of the market. So we are working as the five East African countries, Rwanda, Uganda, Kenya, Tanzania, and Burundi, to link our capital markets. As we said, we are not unifying them into one capital market, but we're integrating them. At least we now have four capital markets or stock exchanges within our countries. And we are linking them one by harmonizing our regulatory framework, the regulatory framework. So whoever is playing with any market within the region, you're treated the same way whether in Kigari or Nairobi or Dalasalamu Kampala. The other thing we are doing is linking the infrastructure, the secretive depository, the trading platforms. And we've already seen ourselves as one market. Like in Kenya, an investor coming to Rwanda will be treated as a Rwandan investor on the Rwandan stock exchange, which is the same across the board. So that somehow helps us to deal with the issue of depth. So we have, at least, East Africans investing freely across the markets. And that's a good development compared to where we are 10 years ago. The other important thing is the payment systems. Today, when you transact on the markets, the settlements are done in most cases real time. You don't have to wait for two, three days for settlements to be done. And that also helps us to improve on our capital markets. I think that the points made by Maria on opening up to the international market, having African countries issuing debt to the international market, that has opened us up to the international investors, which was in the case, again, 10 years ago. 10 years ago, we looked at as, of course, people used to call us a hopeless continent. But I think the biggest problem, we're all grappling with the issue of debt burden, HIPIQ, and the MDRI. We're all working on cancellation of debt. And after cancellation of debt, any investor would not be willing to relate with a country that has just gone to seek for debt cancellation. But after 10 years, we built a track record that now international investors have confidence in how we manage our economies. And when you look at the subscriptions on any debt issued from, like in Rwanda, Rwanda, when we issued our first Euro bond in 2013, the subscription was 10 times the size of what we had put on the market, which has been the case with the other sovereigns. So the appetite from the international investors to invest in African debt is really high. And that gives us hope, because the other limiting factor we have today in developing our capital markets is the level of savings. The savings are still very low. Domestic savings averaging will go 20% in many African countries. And that can't help us to develop our markets. Therefore, this link and opening up and the appetite we see from international investors helps us to cover that gap. I think the other important factor that also acts as an advantage to developing our market is the debt levels of our countries, whether sovereign debt or even private debts. Many African countries are way below 50% of debt to our GDP. So the room to issue new debt instruments on the international market is still big. So I would say where we are today in terms of the environment we are working in, in terms of our relationship with international investors, but also the regulatory framework in general that allows free flow of capital in and out of our economies gives us a good advantage to be on the right footing to grow our capital markets. Sure. It's not just about debt. And surely borrowing shouldn't be taken for granted. It's a function of what's happening all swear. So what about equity? What about the equity side? What about the investment side? And do we really have to depend on money flowing from the US or Europe? Is there more to be done internally by African money investing in Africa? Martina, you're asking a very important question. Just to correct one thing, I'm a humble investor for my day job. I don't look after the banking side of investing. I look after the investment, the asset management side. So savings markets really matter. And I don't compete with Raymond. I use his services. Very glad to know that firms like Citi are in their building capital markets. But from our point of view, I want to link to John's last point. If we don't, and Maria also raised it, if we don't get savings markets developed and get the culture of savings, domestic savings across Africa going, then we'll always be dependent on foreign finance. Now, foreign finance is great. And you've got to take it when you can get it. But it's not always available. I mean, there's quite an ominous comment in the financial times. I think it was yesterday when the chairman of the Financial Service Stability Board and the World Bank Chief Financial Officer warned about liquidity challenges. Now, in Africa, we understand liquidity challenges. Maybe the rest of emerging markets have to learn. But there is a withdrawal. There is a risk premium going to be imposed, busy being imposed on emerging markets. And Africa will not escape that and has not escaped it. So if you then have can use the savings pools either on the continent or in the regions to continue activity. And I think South Africa is a case study that is not well enough studied because it has very developed capital markets as deep as any developed country relative to GDP. And it has managed to sustain and mobilize in quite lean economic times, especially during the isolation periods, managed to sustain economic activity and investment activity because it used recycled domestic savings effectively. And now under the current government and one of the previous finance ministers, they made a very, very important rule change. They allowed the South African savings pool, retirement pool, and long-term pool, which is about $1.5 trillion, to take an additional 5% into the rest of Africa. And that money is starting. And if you look at the number of funds that have been set up on the equity side, most of them are cornerstone funded by Southern African capital. And so I think we've got an important precedent. And we've seen how it worked. And it has driven the evolution of markets. But there's a lot more to do. And I'm very encouraged by Nigeria. Their savings will now go, the last number I saw was $40. I think it must be close to a $50 billion savings pool onshore, copying essentially the Chilean model, which means it's really easy to understand. As an outsider, the money gets administered properly and will eventually build initially debt markets and then equity markets. Right now, equity markets are still very much driven by the foreign investor and then the domestic private investor. Rather than the domestic institutional investor. So my plea would be that we help encourage not single country, because many of the countries are too small, but on a regional basis, strong domestic savings institutions and savings recycling institutions, both insurance and asset management. And I'm very encouraged by John's region. I've never heard a president or a prime minister speak about savings and retirement. It's too long for the political horizon in a democratic country. Yet the Kenyan president, the Rwandan president, Ugandan president, they talk about these things. And I think East Africa is setting a great example of how a region could cooperate. And I hope the other two big countries, South Africa and Nigeria, can draw in the markets around them. Sadeq already has good infrastructure. So I'm encouraged, but it's early stage. It's not large. And it will be driven by the continental investor much more than the marginal foreign. Although very exciting, and that's my last point. We've seen almost too big, but big private equity money raised. And the big US private equity firms have declared their intent not by raising dedicated funds, but by using existing funds. So we, for example, recently done a co-investment with Carlisle, where it's domestic capital, international capital together on the private side. The problem is we still don't have good enough exits on the public markets. And that's what we need to work on. Right. So East African community is probably, if you listen to this side of the debate, the best integrated region, financially at least, on the continent. But we were discussing earlier about the importance of deepening that and creating more infrastructure and common shared regulations around that. Why is it so important? Well, I think it's just so important for the reasons we've all been discussing. You need to get harmonization. You need to deepen the domestic pools of funding. And you need to make sure that, as I think everybody has said, you need to be able to attract, to generate the savings. And you can do that by having more harmonization, better markets, more integrated markets. So I think getting this done, as East Africa has done, on a regional basis is a really good starting point. And you can see the benefits of it.  And so it's about getting that liquidity. It's about getting the depth in these markets. As individual countries, we're just too small. Collectively, we count. And it's about making sure we all understand that. It's about bringing down the costs. It's about bringing down the barriers. It's about creating the right incentives. It's then also about making sure on the back of that we can develop the instruments.  We in 12 countries, Barclays has been on the continent for in some countries for 150 years. And one of the things we've done is roll out a lot of platforms to ensure that we can trade and we can deepen our presence and we can contribute to the deepening of capital markets. So whether that's through the rolling out of our trading systems, our foreign exchange systems, our cash management systems, or the development of new instruments in markets like Kenya where we've listed NCDs or the listing of new instruments in countries like Botswana, it's about deepening and creating the availability of new investable instruments that people can then can look into. So it really is about that. It's creating those opportunities. And what are the biggest obstacles do you think? Looking at it from the outside, you've clearly said that on the city level, and also personally you've identified an opportunity that can't be missed here, so you want to be present. But what do you guys diagnose as being the biggest problems towards realizing that opportunity? First, let me build on some comments here with respect to the South African model. The South African listed exchange is about $1 trillion. Average daily trading volume is $1 billion. The Nigerian exchange is $100 billion, with an average trading of about $25 million. So $25 million versus $1 billion. And $100 billion versus $1 trillion. GDP of Nigeria is $575 billion. GDP of South Africa is $300 and some odd billion. Five years ago, the largest GDP, the largest economy across the continent of Africa was South Africa. Its ability to retain the capital markets has been sustained. The opportunity that exists for other geographies to increase, like Nigeria, is clear. Relative to the GDP, what are the hallmarks that we've learned from other places in the world? One, you need to have four investors for the equity investors. Presumably in lessons learned from other emerging geographies, you need to have strong on the ground operations. Number one. Number two, you need to have strong management teams, strong visible management teams with depth of management. Number three, and perhaps equally, if not more importantly, more heavily weighted are management principles. And what do I mean by management principles? Governance. Whether or not there is a level of independence and transparency in the leadership at the board level. Transparency in the accounting. A record of social and environmental responsibility. Those are the hallmarks of enterprises that have attracted equity investors around the world. They attract the private equity investors. They would attract, to the extent that there's a story, the retail equity investors. And they would attract the large institutional investors. Those are hallmarks. And so if you ask what are some of the challenges here that have yet to be realized in large scale, it would be those enterprises that have those fundamental principles as part of how they operate. The level of transparency that has been reflected in the sovereign issuances, where you get 10 to 15 times oversubscription in these issuances, gives you confidence that there's an appetite for investors both within country, within region, as well as outside investors to invest in this marketplace. If you look across other emerging markets and look at the hallmarks of where the investment has occurred, in each instance you see those principles being applied. They have been less prevalent in these markets because of the reasons that have been discussed. I'll turn to you guys now for a few questions. If you can please keep them brief, make sure that they are questions, not statements. Although I'm sure each and every one of you is qualified to have informed and strong opinions. And so we can just get you more involved in our conversation today. You can put your hand up, please. Yeah, thank you. If you could just introduce yourself also, get a mic to the gentleman. Thank you very much. My name is Chifippa Mohango, Chief Economist of AstroMetal. One of the challenges you face on the African continent is now you've got a very impressive GDP growth numbers on paper. But then when you talk about the issues of the financial markets on the African continent, I'm not sure when you look at this thing from the point of view of a small businessman. Because the topic we're addressing today, if anyone thinks about it, they all think about big business. And my experience on the African continent, traveling on the African continent, as well as also doing some business on the African continent that know, the key challenges we face is more impacting on the small business player. And then the other big challenges that know, as long as we don't have confidence of each other's calluses on the continent, this issue of integration of the African capital markets will never happen. Where, for instance, you are in a country like Malawi which uses a quarcha.  So for a small business player, for instance, what will happen that know, he has to change that Malawi quarcha into a U.S. Dora. And then when he goes to Mozambique, he's converted back to the Mozambican currency. The transactional costs involved, the original amount which was supposed was 10 U.S. dollars at the end of the day when it's in Metichai, it will become five U.S. dollars. So these issues also need to be addressed is the cost of transactions. So I'm not sure what's the view maybe from the governor as well as from Ramos on the, I think there are more experience on that space as well. Thank you. Thank you very much. I mean, it is interesting and if the people who are listening from outside the continent perhaps would think that continent has arrived and it's all PE and IPOs. But what we're hearing here is a bit about nuts and bolts, right, the not very sexy, not very exciting stuff that developed economies have been doing for a very long time and got them where they are today, although arguably that may not be the best place to be right now. But how does that work? And even how does the official sector, the central banks and the finance ministers and the governments encourage lending to that very spine of the economy that you can't really leapfrog even as Africa leapfrogs other parts of development? Yeah, I think one as the biggest challenge in fact we still have today is as we are trying to develop our markets, private sector involvement is not yet that big. I think based on his example, South African stock exchange is really big because they have established private sector players on the market. And you find in our part of the world, we're still mainly dealing with government securities that we are trying to use to develop the markets. And the challenges with the private sector is instilling the corporate governance principles and any private sector issuing paper on the capital markets, issues of transparency and accountability and governance are high on the agenda. And so that creates a big challenge to the small SMEs, the small media enterprises to be able to achieve the standards required to list on the stock exchange. I think as Maria said, maybe she'll say more about the experience or the example of Ghana where they had create a window to handle that. But what's important today, what for example what we are doing in Rwanda, we have a new law creating collective investment schemes where small servers could invest in a fund, buying units in a fund and this fund when it's built into a big fund now it can invest and can be active on the market. So the small servers are active on the market through secondary vehicles, if I put it like that. But the biggest challenge, what's at least what we are trying to do or what our capital markets authorities trying to do is to support the SMEs to bring them to a level where they can have reliable accounts that can be monitored and followed before you bring them to issue any fund IP or any other paper to the market. So by the end of the day, if the capital market is redeveloped, one, it acts as vehicle to finance the big corporates and therefore the other, the banks will focus on supporting SMEs than like today in most of our economies, the banks are really dealing with financing the corporates and they ignore the small and medium. Yet corporates have the capacity to raise money which would be even much cheaper from the market itself than going through commercial banks and therefore retail banks would focus on supporting these small. So in actual fact, when we talk of developing the capital markets, not just the capital markets in isolation, it's probably the financial sector in general that will support the development of the small and medium enterprises as well. Before Maria answers, because she can answer a lot better about the costs of foreign exchange between small market, I think it's a very important question that the gentleman from us or me tell asked, but I'm not sure it's the right question. I think we need to develop capital markets for the larger businesses, get it done. Because if I travel in frontier Africa, as opposed to the more developed parts of Africa, it's easy to find the billionaires. It's not that easy to find the millionaire, right? We want lots of millionaires, lots of successful businesses which have probably been spun out of people who've learnt their trade in larger transnational companies that operate on the continent, made some money by their equity options and then started business of funding their cousins, funding other people. You'll never get a structured financial system doing that. I think the best way you find SMEs is actually through private wealth that goes into a system where it works on trust, but you need to create that. To order to create that, you need to get enough successful businesses which can exit, get the right multiple and sell. So I don't think we should put the burden on the regulators now to say, how do you do financing a very small business successfully through your capital market system? It has to spill down because not even in the most developed countries in the world do they do it effectively. But how does it happen there? It happens through the enormous circulation of private wealth. We need to create that private middle-class wealth and you'll see the cost of business drop significantly. So I think we've got two debates here. One is getting the capital market right for the call it to formal businesses and the other one is to look at the ecosystem as the governor said, of course, then there's still the big question about efficient banking cross-border and efficient lending cross-border, which Maria is far more qualified to answer than I am. So I think, Kendra, you touched on a very important point and that's as you need the ecosystem. Right, so I think you need to do this across multiple layers. So I think you do need to continue to develop very efficient capital markets and we're gonna have to be able to continue funding governments, corporates, getting the costs of doing that as efficiently as possible. But there's also no doubt that we have to do and be a lot more creative about how we think about financing smaller, medium-sized enterprise, particularly on a continent where the bulk of business is in that part of the market. So I think the gentleman from Asalor has pointed out a very important area. Probably the ratio in my mind or the number in my head is something in the order of 85, 90% of businesses across the continent can be broadly defined as smaller, medium-sized enterprises. So finding ways of efficiently financing those businesses is really important. I know as a bank, it's something that we're very focused on. I mean, we've set up a smaller, medium enterprise fund. We've got enterprise development centers. We've created portals for smaller, medium-sized enterprises and we've helped train tens of thousands of smaller, medium-sized enterprises. And I know that as much as we do, there's still a lot more that can be done and we need to be a lot more creative about it. I think this is one of those areas where actually the availability of technology and digital banking creates new opportunities for us, both in terms of the provision and the reduction of costs in terms of getting banking to smaller, medium-sized enterprises and making it more accessible and inclusive. I think the other thing we need to also do is to recognize that making payments across borders is expensive and there's still a lot of regulatory burden in getting a payment made across borders. And so the cost of making payments across borders is something we need to all work on. It's incredibly expensive. And so even if we have a great digital product and create a great digital wallet, you're often having to deal with exchange controls. You have to deal with KYC, you have to deal with all of the regulatory stuff that by the time you get the payment across to the end user on the other side, you've added a significant amount of cost. And I think we can make that a lot easier working between the private sector and the regulators to reduce the costs. Particularly in a world, we talk a lot about integration and we still have enormous burdens to move goods and services, financial capital, and people across our borders on this continent. Unless we can reduce all of that, growth is always going to be suboptimal on this continent. Unless we really mean what we say when we talk about integration, which is bringing down the barriers for people to move, for capital to move, and for goods and services to move, it doesn't matter. We can build the best infrastructure in the world. It's not gonna deliver the goods. My just one observation here that we've learned from our own strategy, which may be applicable here is we have a strategy for what we call emerging market strategy, which is to essentially support the large emerging multinationals. Here would be the MTNs, the Napsters, the Woolworths of the world. It may be the case that you can develop a capital markets if you develop a pan, I'm gonna relate to say pan-African strategy, but certainly a regional strategy where you can have regional champions that can create the scale that can bring down some of the cost barriers. 90% of the business is being formed here being SMEs. To have a primarily local strategy will I think hinder some of the ability to attract the capital. A pan regional strategy, then a pan-African strategy could attract a lot of capital. And a pan regional strategy allows you to operate with a higher level of productivity and more efficiency that will therefore bring in the capital. Focusing, and perhaps it's the reality of the marketplace, focusing primarily on the local SMEs will get you only so far.  After that, you're gonna run into the issues that you've outlined. But I think the point here, breaking down the barriers on the three regions in sub-Saharan Africa need to interregionally really effectively and efficiently break down those barriers regularly, otherwise not invent different rules just for the country. So the European talks about that. Every conference you go through, every WAF, every African Development Bank, that is all about regional integration, starting with roads and infrastructure and going to financial infrastructure and intangibles. And it's not easy. Europe's been, the European Union's been doing it for decades and they're struggling with it and they're now regretting it because they're at the bottom of the cycle and they're like, I'm not sure we want your labor anymore and maybe we should close those borders. So how do you do it? I'm afraid. I mean, you have some really well-developed economies there. Of course. I'm just thinking one issue. And I think we must just be very careful because one down cycle doesn't create, it's just a cycle. Doesn't call the model into question. Doesn't call the model into question. So, and I think we must just make sure that we don't overstate the problems. We have a lot more to gain by integrating our markets, right? By creating the opportunity for people to move around. I think those arguments are really convincing. But why is it so hard to do? Well, frankly, I think it takes, and I know this is always controversial when you say it, but it actually takes political will to get it done. You know, there's, and you know, it's, if you bring down, if you have the political will, you can really get a lot of the stuff done. You know, you can't get, you cannot get, you know, a, the rules of the game harmonized without getting the people who can make these rules around the table agree the rules. And so it starts with getting the political will and then getting the other actors that make this happen around the table. So get the political will to do it and then you have to get the private sector around the table and say, this is what we need to do. Can we all get behind this and let's get this done? Then I think it begins to happen. Actually, to your point, to this point, the example exists notwithstanding the challenges. The example exists in the European Union where as a union has been formed, the experts said given the cultural differences here and the political differences, it would never occur. But the example is just as you said it, there was the political will at the top and then they brought the private sector together. Clearly they're having challenges now given the cycle. I've never heard private sector people before asking the government to lead something. This is fascinating. I think we just have to appreciate where we are. Sure. I think the example with Africa been referring to is a good one because today our presidents are leading these initiatives and because of that we've been able to break many barriers. Today, East Africans travel using just identity cards in no longer one. You don't even need to have your passport to move across our borders. We've now linked our communication as one network area across the East African community and that is feeding now into the mobile payment systems as one network and that reduces tremendously the cost of paying money across the borders. And what we are doing now as central banks, we've just signed an MOU and we are moving to currency convertibility. So the issue of fast changing into dollars then back to local currency that we want to remove and we've established an East African payment system where you easily make payments across the border. So, but the push from our presidents has really... And let's not pretend. I mean, I think we all know that it has not been smooth. These are all outcomes that I understand, you know, leadership in East Africa takes pride in but it has been a very bumpy ride into this marriage. I don't want to, I'd really love to take one more question. I mean, I think no one is saying any of this is smooth and it's taken the European Union decades to get there and we know it's not smooth. So none of this is smooth. None of this comes without consequences or even costs but not to do it is also incredibly costly. And I think this conference is about reimagining Africa. Think 10 years ahead, think about regions on this continent if where people can move around across East Africa, across Southern Africa, across West Africa without needing passports where you can make payments, where you can have currency convertibility, where you don't have exchange controls to worry about and I think you've got a different kind of economic opportunity. The arguments are completely compelling. Let me take one more question because we have 10 minutes. Oh, I'm afraid I'm going to disappoint but hopefully we can all chat afterwards. Maybe the lady here on the left, thanks. Good morning. My name is Tsou Insani from United Capital PLC and an example has been made of Nigeria and specifically the size of our capital market relative to the size of the GDP. And one of the issues that have come up in recent times is how to get the proposed champions like MTN who operate in our market and do make significant revenues to actually list their securities on the market and the question has been, should it be a carrot or a stick method and the debate has been ongoing and I just wondered whether members of this panel had a recommendation as what would be the ideal model actually to encourage and bring in those kind of major players that are in our markets and whose activities obviously would have the huge capacity to grow our capital market if they came on board. Thank you. Anyone interested in taking this specifically? I would just say the two key points. First, if you talk about, if you're just going to list foreign subsidiaries, you want foreigners to come to your country and build a business, create employment, then MTN has made a major contribution to Nigeria, benefited massively from Nigeria. To necessarily ask them to complicate their corporate structure and list the local subsidiary, you could if it's an extractive industry but it's not always feasible. It should really be about bringing the domestic champions or the regional champions through and ask MTN or the foreigners to use the domestic debt markets to finance themselves to help develop the debt markets because they're great benchmark issuers. They're quality issuers. I mean, debt market and real estate market really could be driven by a great foreign tenants or top quality foreign issuers and not necessarily confusing the corporate structure. If they are a local business that's been acquired, of course it'd be great to advocate for them to share the equity and stay internally but it's about getting the sort of the next level, the access banks, those guys to a scale, the taking the various Django businesses as he sells out, taking them to proper public positioning, free trade at positionings in the local market as regional champions. But the point I just wanted to add when we didn't discuss it today is, and that's where East Africa has a lot of work to do, you have to build a proper yield curve in the debt market before any capital market can work. In other words, governments have to have a proper debt management function where they issue, even if they don't need it, long-term domestic debt across the term structure. So it's priced off which the private sector can be priced and off which we can develop the much needed, which we haven't discussed, corporate bond market. Because corporates don't always wanna borrow from banks because banks are gonna charge a lot more than the New World Post-Financial Crisis, they want to borrow from the markets. And that is where we need to sort of think and focus with a policymaker. And if we get that right, and I think interestingly, there's some very encouraging signs in Nigeria, but we, a significant part of what we do is investing in local currency-denominated debt across the continent. But if you can't price off something, you can't give it. And that's where I think coming back to the MTN issue, help use the foreigners as domestic debt benchmark issuers. And they'll probably do it to win favor with the local mark. I agree with that. Maybe time for one, one last question. I haven't turned my back on anyone for so long. I'm so sorry, just checking. Okay, what about the gentleman over there? My name is George Umbima with the IFC Asset Management Company. And this question is from Mr. Dutouat, I'm spelling your name, sorry. Okay, George. The question, you mentioned in passing that perhaps there's been too much private equity and money raised for the continent. Could you please comment on the too much part of that statement? I think there's never too much. Let's just be clear, there's never too much money. But because private equity comes in vintages and in seasons, you find that investors tend to allocate or commitments at the same time when it's in fashion. Now, we all know there was a big emerging market fashion which spilled over into a frontier market in an Africa fashion. And then the big allocations come in one year. And then investors are sometimes forced to deploy capital slightly too quickly. So I would just say we had nothing. You don't, George, don't remember the time when we started, when I couldn't even convince these guys in our office who are living in Africa and investing in Africa to invest in Africa. That was 20 years ago. And so there was a time when very little formal capital moved across. And so to look for this sort of big deal, we, for example, decided to focus on the mid-sized deal because we think there are a lot more. The mythical $500 million deal or billion dollar deal is just not, there's just not enough of them and you'll chase them and you may overpay. If you could spread private equity patiently over 20 years, of course the money isn't enough and of course we need a lot more. So take my comment in the context that all good things seem to come at once and then they don't come when you need it. It's like your banker. Your banker's always there when you have money. When you don't have money. But Maria's always there. Maria's always been there for us. So it's only in that context. And I think I'd be encouraged more and more private equity involvement. I would just not expect that, you know, and if you look at the volume of large deals that they would materialize overnight. Once the public markets are big enough for the exits to happen, you'll see bigger and bigger deals happening because then people see a door. So that's the context in which I commented. I'm afraid we're gonna have to wrap it up for this morning. Seems like regional integrations is and a lot of initiative and courage demanded of elites and political elites on the continent is one of the key messages but also don't over depend on foreigners. Do it yourself if you can. And an encouragement of a savings culture that can really deepen and make those markets more liquid as well as clear integrated regulation that can assist those markets to develop. I'm sure these characters around here are gonna be contributing substantively to that and the futures they have in the past. Thanks so much for joining us and sorry we can get to all your questions and enjoy the rest of your conference. Thank you. Thank you. Thank you.


So, as always, my talk is online, talks.php.net, Singapore 18, this time, Twitter at Rasmus. I'm old. I've been around for a long time. This was my first computer. For some of you in here, this probably looks more like a calculator, but this thing had 1K of RAM. The box at the back here is actually a memory expansion module that added 16K, so I had 17K of RAM in this beast. It seemed like a lot at the time. I didn't know what to do with all that memory. But now, if you think about it, it's 17K of RAM. I mean, all the selfies you guys have been taking with me are like 5, 6 megabytes, right? The difference between then and now is astounding. I had a VIC-20, Commodore 64, Hayes Modem. This was how I connected to the internet. There wasn't an internet, but to BBS's and things back then. So this was my world growing up, sitting there and waiting for Z-Modem to download stuff for hours and hours and hours. In the 90s, I did a lot of stuff with Gopher when I was at university in Canada. This was the closest thing we had to the web in the early 90s was Gopher. It was mostly for academic papers and things where at the bottom you could link through references. It was text-based, but you could cursor down and you could click and you could go and read the reference to this particular paper. So Gopher was quite heavily used in academia, but outside nobody knew what it even was. The world changed for me in 1993 when Mosaic came out, the first graphical web browser. This was when I looked at it and said, okay, this is what I want to do. This is going to change the world. And this wasn't any great insight on my part. Everyone could see that this was going well, not everyone maybe, but lots and lots of people as soon as Mosaic came out, saw that this is going to be special. So that was when I started PHP. In the early days, I wrote tons of code that looked like this. So C code with HTML embedded in it, and I got very tired of writing code this way. And I was writing the same code over and over again, so sort of the same template C code from one project to the next. And if you just wanted to make a slight change to the HTML into the layout, you have to recompile and redeploy your C code to your server. That was just not a good way of solving the web problem. Most people started using Perl, something called ModCGI. To me, this was just sort of a slightly shorter way of doing the same thing, and it had the same problems to me. Here they've abstracted away HTML, so you had to know how to do it within this particular module. You had to know that you had this H1 function, for example, in order to spit out an H1 tag. I didn't like it at all. I didn't like programming my HTML. I wanted to be able to have other people do the simple stuff, the layout and the look and feel and to make nice looking pages. I just wanted to provide the back end logic for it. So basically what I wanted was HTML with some server-side logic access directly from the HTML template. So this was early PHP. I didn't actually have the closing question mark here, but for the syntax highlighting it, it shows up better when I have it. Back then it only had the beginning, the opening question mark, because I didn't fully read the spec, the SGML spec behind it. I fixed that later on. It took a while. This was my aim. My aim was a very simple templating system that would let me make calls into my business logic scene. I got it completely wrong because I thought the world would want to write heavy business logic in a compiled, statically typed language. Nobody agreed with me. What I wanted was for people to basically expand my templating system with their own set of tags, and those tags, the code behind them would be written in C. What I put out there was the basic C API to talk to web servers and to do all the basic things, read the post data, handle cookies, all the templating stuff that you have to write yourself every time. I provided for you and I said, okay, here, plug in your own set of tags. Just add your own C functions here that implements your particular business logic for your site. Then I had a very simple templating system that let you put these tags into HTML and it would parse the HTML and then call those C functions. I put out some sample applications like a guest book and various things like that. People said, this is great, but I see you have an if condition, but there's no else. Can we add an else to the templating system? Okay, now we're getting into business logic here. That should be in C. It's not business logic, it's still just display logic. Then they started asking me, well, what if we want to use the same block many times? Can't we have loops? Okay, let's add loops. Then I said, well, it would be nice to be able to sort of group our tags in function calls. How about function calls? I was like, okay. Slowly but surely, they tricked me into writing a full programming language as the templating system. I kept trying to convince people, no, you're writing, this is not business logic anymore. I went to their websites and I looked at some of their stuff and they would send me bugs and I could see their code. It's like, you're writing all your business logic in the templating system.  I basically had the whole industry miscalculated. The web was growing so fast and there simply weren't enough C developers in the world for the growth of the web. What they wanted was a very, very simple and easy to use templating system that they could just take existing HTML and make dynamic. They didn't want to write C code. So eventually, after many years, they convinced me to say, okay, fine, let's say it's a programming language but I was extremely reluctant for years and years to even admit the fact that it was a programming language. It wasn't supposed to be. It was supposed to be a templating system that let you write C code. However, be that as it may, here we are. Many, many years later, 25 years later at least, we now have PHP 7.3. This looks nothing like the first versions of PHP that I wrote. And everyone in here who's giving me all this credit for giving them jobs and all this stuff, it's not me. It's lots and lots of geeks over time that have taken my idea and made it tens of times better. This is so much better than anything I could ever have imagined. So some of the changes in 7.3. We have a flexible here dock now. So you don't have to have your ending terminator in the first column anymore, which was kind of wacky. So now everything, the number of spaces or tabs or whatever you use will be deleted from the contents of it. Whatever indentation you put on the ending thing will be removed. So in this case, it'll just have bar on the line by itself. It won't have the spaces even though it's indented in your code. Hopefully that makes sense. This is just about the only place in PHP where white space is significant. But it is in this case. For a good reason, I think. There's a new warning. This is kind of a weird edge case. People who put a continue statement inside a switch case. What does that actually do? So if you're in a while loop and you have a switch case and you do continue. I think some people think that's going to continue the loop. It doesn't actually in PHP. It's actually like a break. And this has caused some bugs for people. So now there's a warning that says since you're not using a break or using a continue, maybe you meant to continue to in this case because that will continue the loop. Otherwise you're just breaking the case here. You can now use references and lists in the listing text of both lists and also the shorter square bracket form of it. You can use references. So in this case, B would end up being a reference to two here. You couldn't do that before. In earlier versions of PHP 7, we added the ability to have trailing commas everywhere. Everywhere we missed one spot which was in function calls. Now you can do that in 7.3. You can have a trailing comma. Not in all cases. But in this case here, you can have a trailing comma. There's also a new monotonic timer function called HR time. So a monotonic timer is a timer that always moves forward at a constant rate. So even if say the system administrator changes the time at the root level on the server or if there's a leap second or anything like that, that actually changes your system time. If you're not using a monotonic timer, sometimes your clock in your program, as far as your program is concerned, can go backwards. Summertime, things like that. There are times when the system clock changes on you that can cause real issues if you have some timing sensitive code that's relying on measuring. If time suddenly goes backwards, bad things can happen. A monotonic timer can never go backwards. Those of you using FPM, there's a new FPM get status function that turns a huge associative array. So an overall and then for each process that you're running, it'll let you know what it's doing, the process ID, the fact that it's running, how many requests it's had, what the last request was on it. It's a lot like the Apache scoreboard or like server status on the Apache web server. You can now get that for PHP FPM very easily. There's also a new is countable. This is one of the things I was running into at Etsy when we're upgrading to PHP 7.2. Because PHP 7.2 is quite a bit more... It's more strict about what you can count. So if you're trying to count things that aren't countable, so if you're calling count on a non-array or non-array access or countable object, you're going to get a warning now that says that this thing is not countable.  Then you can call count. Now there's a new function in PHP 7.3, so you can just call this countable on stuff and it'll let you know if this thing is countable. You should know already, but in cases where your code is very dynamic, where you're passing random types everywhere and you need to check, you can do a countable check. Two new array functions. Key first, key last. A lot of people were using reset and end to get the first and the last element of an array. The problem with that is that it moves the array cursor and it also... Since it modifies the array cursor, you couldn't do it on things that didn't actually have an address. We couldn't do it on a real array. You can't modify this thing. This one is a read-only. Get the first key, get the last key. Another new thing in 7.3 is the DCE and SCCP that we started introducing in PHP 7.2 has gotten a lot more interesting. And I'll cover that separately. Some other changes. We're now using PCRE2, which is a regular expression library. There's a new major version of it. It shouldn't break anything, shouldn't. There are some edge cases where in really weird regular expressions, it might behave differently. So if you do upgrade to 7.3 and you find yourself with test cases that are failing, check if that test case has a really complicated regular expression and see if some change in PCRE2 might have broken it. Some other things. Get all headers. One of the things preventing some people from moving away from mod PHP with Apache to PHP FPM was that they couldn't get all the request headers easily. That's now available for FPM. Some stuff for MB string. We also escape the hash now in PREC quote and a couple of other things. So things that might break your code. If you upgrade to 7.3, PCRE2 could, should be rare. I haven't found any breaks. So I manage the code at Etsy and we have millions and millions of lines of PHP code. This particular change didn't break anything for us. But it depends how weird your regular expressions are. If you're relying on old UBC router or bird step, and most of this room, I would say pretty much everyone in this room don't know what that is. Great. You don't have a problem. And there are some various deprecations that will throw some warnings and notices. So see the upgrading document please. For all the, I just gave you highlights. There's quite a bit more things. Please read the whole thing. If you're writing extensions, check the upgrading internals document where there are some hints on what has changed internally that you might need to go back and fix your extension for. So, most of you know, as one of the things I talked about last time I was here was the huge performance boost of PHP 7 over PHP 5.6. You can sort of see the progression year by year by year as we're going. But 7.3 actually has a little bit of a boost. It's nowhere near the big jump from 5 to 7, obviously. But it's pretty good. If you're still on 7.0 or 7.1, 7.3 is going to give you a little bit of a boost, probably 10, 15 percent, which is pretty nice. And latency has dropped as well. It's not a lot, but here, PHP 7.0, 47 milliseconds latency on WordPress 498, down to 38 milliseconds. That extra 9 or 10 milliseconds is nice. Gives you a bit more headroom for other crazy things you might want to add to your site without blowing your SLAs. If you have latency SLAs, I do. You should, too, actually. That should be a test failure. If your pages start getting too slow, it should fail.  So keep paying attention to that. And you can buy yourself some time by keeping PHP upgraded, because we're always going to be faster with the new version. Well, hopefully, 7.4 has tight properties, which is going to hit us a little bit, but I'm hoping Dimitri can come up with some magic and still make 7.4 faster than 7.3. Right now, 7.4 is slower than 7.3, but it's very, very early in the lifetime of 7.4, so I hopefully will overcome that slowdown. Memory-wise, PHP 7.0 is awesome. It uses a fraction of the memory that PHP 5.0 does. If you're still on PHP 5.0, you shouldn't even be in this room. You should be at home, at the office, upgrading. There's no way you should have time to be sitting here, because it's crucial.  Get onto 7. It's better for everything to do that. It's better for the planet, too. Do a little bit of math on it. We have around 2 billion sites on the web, 10 million physical machines, PHP is on about half of them, roughly. And I think last time I was here, I talked about 5% PHP adoption, PHP 7.0 adoption. We're getting close to the 50% now. We're not quite there. We're a little bit under 50%, but around 50%. So about 2.5 million physical servers. And by upgrading from 5 to 7, well, this is about what it takes running a server, like 3,000 kilowatt hours a year. In the U.S., it costs about $400 to power this thing, and then you double that to cool it. So it's about half a kilogram of CO2 per kilowatt hour, right? So at 50% adoption, this is what we're saving, about $2 billion a year, by switching from PHP 5 to 7. But let's get to 100. It's good for everyone. So please, upgrade to PHP 7 if you haven't already. Like I said, PHP 7.3 has much better DCE, Escape Analysis and SCCP. This is one of Dimitri's babies he's been playing with for the last couple of years. And it's pretty fun stuff. You should go, and if you're interested in compilers and optimization and things, go have a look at this DCE and SCCP code in PHP. It's cool. I'll show you some of the things it does. So in the very, very simple case, it can eliminate stuff like this. So if you have a function, set A equals to 1 and return 0. Obviously this assignment is completely useless. It doesn't do anything. Variables in PHP functions and methods are not global by default. You have to declare them global, right? So this is a local variable that is not used. It's useless. In PHP 7.1, if you dump the actual op codes that gets generated, and you can do that with this fancy looking line, you see that it generates the op codes that assigns $1 to A, and then it returns 0. In PHP 7.2 and 7.3, it doesn't even create that op code. So it just says, well, I know this thing doesn't do anything. I'm not even going to include it in the op cached version of this code. So what's actually cached in the op cache, which is what gets executed on every request, it's as if you didn't even write this line. It just disappears. PHP deletes it, right? You can try to trick it, and this is where PHP 7.1 generates a ton of op codes on this piece of code here. The trick is that you're getting a bunch of inputs into the function. Assigning all those, you can concatenate them together, putting them in X, but then you wipe out X, and then you return X. These ones are actually no ops. They don't actually do anything. This is just indicating which internal variables the four past arguments end up in CD0 through 3, and the optimizer has figured out that these two lines of code, never mind even the assignment X equals 0, even this isn't used. You can see the generated op code is just return 0. So this entire function is reduced to return 0. There's no concatenation, there's no X variable even, just to return 0. And as you can imagine, this set of op codes runs quite a bit quicker than this set of op codes. You can try to trick it. B equals A, plus equals 3. This is valid PHP. This assigns both A and B to the same thing here. Return A. But here PHP 7.2 and 7.3 are smart enough to figure out that this B assignment is completely useless. So it adds 3 to A and returns A and just deletes this part of your code. Now here's where 7.3 starts getting smarter than 7.2. So if you look at this code, I'm passing in X and Y integers. Then I'm creating an array that contains X. Then I'm setting A1, so the second element of the array I set to Y. Then I wipe it out, A equals Y, then I just return A. Obviously in this case, sorry, if I scroll this slightly, all we really knew is these two last lines, right? A equals Y, return A. And here the optimizer in 7.2 wasn't quite smart enough to figure that out. In 7.3 it is. All right. So the escape analysis part of this I think is really cool. Take this little snippet of code, class A, function through new A and you set it properly in A equals X, return X. PHP 7.3 just deletes it all. This code doesn't make any sense. I'm not going to compile this at all. All I'm going to do is I'm going to create a function that receives an argument and returns the argument. It has seen that there's nothing happening here. This A object doesn't do anything. It doesn't have a destructor. It doesn't have anything that can escape from in here. So it looks up a level, the optimizer in this case, and sees there's no point in object A. Let's just ignore it completely and just generate these op codes. However, if you add a destructor, then suddenly there is a way that something can escape. So in this case, if A has a destructor, it means that when the A object falls out of scope of the function, some external code is going to run that could have a side effect. So in this case, the optimizer is smart enough to say I can't delete this object and it leaves everything in place. Now, maybe a future version will also know that, hey, this destructor doesn't do anything. But right now, we're only looking up one level. We're not going deeper into those levels. So here it just says there is a chance that something might escape, so I'm not going to optimize this away from what I think is interesting. So here we're passing in an integer, right? So if X is true, then we're setting A to the array 01. If X is not true, the passed-in integer, then we set it to 02. Then we return the first element of the array. Now, in this case, it doesn't actually matter what X is, because it's always going to return the first element and the first element is always going to return 0. So this thing is always going to return 0. And the optimizer is smart enough to figure that out. It looks in the contents of the array and says, hey, this function just returns 0 no matter what's happening in it. So that's all we're going to make it do. That's really cool, because there's a lot of branching and a lot of checking and creating arrays and stuff that would otherwise have to be. We'd have a page of opcodes in this particular case. And it just reduces to 1. Return 0. You can try to follow along, but the optimizer has determined that all this code does is echo 1, return 4. Forget all the other logic. This is all it actually does. So that's what we're going to cache in the opcode cache.  Because you're writing code like this. If you're getting a 50% speed increase, it means that the optimizer eliminated half your code. You're writing tons of redundant code. Decent code, you should see 5% increase, maybe. Anything more than that is sort of an indicator that your code is terrible. And I wouldn't post it all over Twitter saying, PHP 7.3 is great. I got like 100% speed increase. Because people will look at you like, aha, okay. And it might be true, but it says something about your code. So, one of the things that can help you a lot with your code quality and also to upgrade things is static analysis. I started a static analysis project a couple of years ago, called it FAN. Very unimaginative. You can get it from GitHub. FAN. Easy to install with Composer. Composer require dev fan fan. You can create a config. It depends a little bit of your layer of your code, but for sort of a standard Composer style project where you have a source directory with your code and a vendor directory with all your Composer packages, you can set it up like this. You can say, this is the directory I want you to analyze. I also want you to include all the stuff in vendor, but don't give me errors about it. Just include it so I have all the object references and all the prototypes and things, but don't give me errors about someone else's code. So in this case, just stuff under source would actually report errors.  You can also further hone or configure your configure file here to say only certain types of errors are things you're interested in. Because by default it's a pretty long list of very common mistakes. It's interesting to read, but sometimes if you're adding it to an existing project, there's just no way you can fix them all. So you can tell fan to ignore certain types of errors. So some of the things it checks, it checks way more than just this, but it does all of these. It also lets you do enhanced PHP type annotations. So here we have a function fn that takes a variable called union which is not typed at the PHP level because it can take either a string or an int. And PHP itself does not support union type. So you can't add a type here. So this is where a fan type can help you or PHP doc type. We say this can be either a string or an int. PHP does allow you to say an array, but it doesn't let you tell it what type of array. So here a fan can be used to say this should actually be an array of integers. If you pass me an array containing anything other than integers, show me an error. And you can also have a shaped array. So my third argument here is a shaped array that says this is an array that has to have a key named mode and a key named max. And the values for these two has to be string and int. So that's getting very specific. Right? That it has to have these two particular keys for it to be valid. So then if we try it this first one matches all of it. The first one is a string which is good. This is an integer array. And this one has both mode and max. So that passes no problem. This one as well passes nicely. What do I change? Oh yeah. I made an int here. So this shows that it can take a string and then this one I reverse the order. It doesn't matter the order of the keys. Arrays in PHP are ordered. But in terms of this it just means it has to have a mode and a max key doesn't matter what order they're in. Now we start getting mistakes. So here I'm passing in an array of integers in the first argument. And fan comes up with this error. This says argument one, which is union because that's the name of my variable here is an array but it takes either an integer or a string. So it's quite verbose. It tells you exactly what's going on and exactly the mistake that you made. And then in this case I'm passing in an array but I don't pass in an array that has mode in it. And here again we get an error that's quite precise that says this is the shaped argument and you're passing in just max 10 but it takes an array that has mode and max. So that's the type of errors you can expect to see from fan. You can also write plugins that comes quite handy to for a large project if you have a company that relies heavily on PHP writing plugins that figures out some of the very specific quirks of your code can be very very handy. We have a custom ORM for example at Etsy that creates these dynamic objects that there's just no way to statically analyze without knowing how that object creation and how that object naming is done and we have a plugin that figures that out for us and you can use some of the example plugins as a guide. There's also a daemon mode which I think is pretty cool that lets you hook this into your IDE or even just your VI text editor and have it spit out errors very very quickly on demand. So if I pop over here to my fan demo so I have a source directory basically I have it set up the way I set it. I have a source and a vendor directory I have a .fan config file that just is set up like this source vendor. If I run fan it will find these errors that I showed you. It's the same file I just showed with the shaped and union stuff but I also have a little test script in here that's very very simple. It takes an integer and I call it with an integer. Now if I change this and I pass in a string and I try to save my file oh I didn't notice that sorry thank you not quite there ah it moved on me. So when I try to save it I get this VI error internally that says right there right when I try to save the function takes an integer right and then if I go back and I fix it now it will let me save it nicely with no errors right now you don't need to hook it into your editor like this but it's kind of cool to get PHP storm functionality in any text editor do you want and in order to do it there's various scripts for various editors. There's this fan client that you just run it's not on my path it's on my client that you hook in the VMRC so here I don't see it it's off the screen but you can go look in the documentation for it it's very very easy to set up so Daemon mode is cool I have a little video that basically does the same thing for people who aren't at my talk now next cool tool is called PHP Spy this was stolen from the Ruby community in a sense because they have an RB spy function that I think is pretty cool so it's a co-worker of mine at Etsy and Daemon that wrote it it's a very low overhead sampling profiler and what it lets you do is sample an already running PHP script and see what is this damn thing doing it doesn't have to be already running you can also just run one so in this case here I'm saying sample every 200 milliseconds it's in nanoseconds so you have to kind of count the zeros so this is 200 milliseconds so every 200 milliseconds take a sample and the script I'm running is just sleep one so you can see the output five times I get a stack trace that says main sleep right so because this thing is sleeping for one second and I check every 200 milliseconds that's what I should expect to see every 200 milliseconds I check I'm still in sleep done so that's the output from now now this is obviously not very useful but it's to show you exactly what this thing is doing it's checking what's happening in this program and you can attach to a running one so here I had some PHP FPM processes while I was benchmarking WordPress I attached PHP spy to it so peak wrap minus N I just grabbed one of the process IDs for PHP FPM minus P says I want to grab this process and you can see some of the stack traces I'm getting back so at the first check and by default it's every five milliseconds that it'll check so in the first check here I was in the load PHP second time I was somewhere in WPDB which is the database calls which it spends a lot of time in those but even this how do you read that what are you going to do with this information it's just a bunch of stack traces so what you can do and what PHP spy comes with is a stack collapse and the flame graph that generates a flame SVG so I ran this against fan in this case so when you're running a long fan analysis and this is what I got out cool flame graph where it can click on things and zoom in and I can see okay so this thing took quite a while let's go and zoom in on this part and then you can go and look at all the individual things so here's a post-order analyze we ended up calling this thing here and basically what we found it really really useful for at Etsy is we have a bunch of gear man things we also have some cron jobs that run in PHP every now and then one of these just runs forever and it's really cool to be able to just PHP spy minus P that process and then looking at the flame graph and then seeing ah okay this thing is spending all its time in this database call because that particular database is overloaded and slowing everything down so it's like attaching GDP to it and trying to do a stack trace except it's a much much nicer way of doing it because in GDP if it's hopping between three different things it's just by luck if you catch the right one with a flame graph you can see how much time is spending in all the different parts of the code and if it's not what you expected it gives you a lot of information on how to where to start looking for the problem in that code so I really like PHP spy especially because you can just run it on any you don't have to build it special you don't have to have debug symbols or anything in it it just kind of does its thing alright so I've left a little bit of time for questions hopefully I can't quite figure out our schedule I think I started quite late but a few questions at least what's my timing like random okay we can also leave all the questions for the Q&A today if you want let me take one or two on specifically some of this stuff because we might want to use the time later for other stuff any questions on this stuff yeah in 7.3 optimizer you said that the class would not get cold at all what if that class has some side effects right creating a file or opening a database connection or something right correct so in this particular case and I showed that in a particular case the class has a potential side effect right so in this one I know it doesn't because the class is empty no but the A constructing an A can have a side effect there is no constructor this is the class okay so that's what I was showing basically the difference between this slide and this slide is that I added a destructor I could also have added a constructor but that's how we know there's no constructor there's nothing in the class that could possibly cause a side effect then we can remove it now it's very rare granted it's very rare that you have an empty class like that but there are times where there are weird dynamic ORM things that have empty classes for stuff and when they aren't filled in it's nice that the optimizer can get rid of them others really maybe all they need is coffee one at the back oh that's Derek he doesn't count do you want a question or not okay okay so how does PHP Spy actually get to the data how does it do that basically the same way GDB does in a sense so not quite the same it's like a smart GDB in the sense that it knows the addresses of special things inside PHP so when you compile PHP Spy it has built in for the various versions of PHP so if you look at so we have offsets so if we can find the bottom address we know at which offsets all these various things are which is why you don't even need debug symbols which means it can figure out what's based on where things are in memory it's quite magic actually it's really really cool magic but it is a bit so if you change your PHP version you need to recompile PHP Spy for that particular version that you have installed you have to just remember that because it is version specific it needs the right symbols and the right offsets for it to work yeah Patrick once you don't need any extension existing on PHP side for PHP Spy yes now you don't need anything okay so it's fully magic when do you have when do you have overhead only at the time you are going to so there's going to be overhead in the same sense that when you try to S trace a running process it slows it down a little bit it's not Valgrind sized overhead because there's no virtual machine or anything it's not Valgrind sized overhead so yes but normally when you're desperate enough to run PHP Spy on something that's running wild you don't care about a 5% slowdown of this thing that's already taken forever you just want to know what the hell is going on with this particular piece of code so in that case it is very very low overhead but there is a little bit you're right when you're talking about the new compiler you had a command line can you show that okay so this first part here so minus D sets I and I options you could put some of these in the I and I file as well but this sets optimization level to negative 1 that first means turn on everything because it's a bit field and minus 1 in the bit field turns on all the bits so I'm turning on all the optimization levels then I set the opcash optimization debug level so this magical hex value this magical hex value is the please dump the opcodes after optimizer has run and then the script would be the that would be the file you want so if this wasn't a file named script for example I can show you and how would you export it to a file so I'll show you so let's go into my fan demo directory oops and in my source directory I have our little test.php so we just go like this and we run it on test.php and we get this now in my slides I had cut out the main part in most of them so here we see two blocks we see main that's not inside a function or a class right all this does it basically initiates a function call right remember my script is test fn1 this is in the global scope right so that's this part up here and then my function test fn is here so that receives an argument and echoes out dollar a and returns null so that's the entire set of opcodes for this function and it's just running it from the command line okay so usually I work within a large framework so I work in Drupal and it has like thousands of lines of codes and methods and functions but you can still dump the opcodes for any particular file right and then you can grab that if you're interested in a particular method just grab the output and find it'll say in the left column the name of the method then grab and look through and see what's there okay thanks it is quite handy I mean when people ask me questions at Etsy for example it's like what's faster should I do this or should I do that like there was a question the other day someone was saying let's see the question was something like this dollar a equals 17 should I do not not dollar a or should I cast it to a boolean dollar a right because not not something this is equivalent to casting to a boolean and he was saying which one is faster has not not been optimized and the easy way to answer that question shut up fan the easy way to answer that question is just to dump the opcodes and here you can see at the opcode level PHP doesn't care if you use not not or boole a boole cast the optimizer ends up or the compiler compiles it to the same set of opcodes so not not and the boole cast are identical in every single way you can imagine other than readability right but the generated code is identical for those two particular operations so it's a really good way of settling arguments as well which is faster right because I mean if it was like hacker news or something there would be a massive thread on which one of these two is faster because not a single idiot on that site knows what the hell they're doing right so this is how you answer questions like that this is definitive the answer you can't argue this others so the question was what's new in 7.4 we're still working it out so the latest thing that passed was type properties so that's the main thing right now we have in 7.4 and type properties just means you have a class property you can now add a type directly to it we have tried it before but there's always been performance limitations because every time you assign something to that property you need a check and that's not something we traditionally have done in PHP on variable assignment we don't want to run additional checks because that slows everything down type properties is sort of limited enough that it's not as bad as doing like type variables everywhere because that would really really be a performance hit type properties aren't set as often as variables or incremented like in a loop usually or anything like that you usually don't have like at this I and that's your loop counter right if you did in 7.4 that code is going to run the hell of a lot slower as opposed to just a local dollar I loop counter right so don't do stuff like that in the future before 7.4 it wouldn't really matter we can increment a property just as well as a local variable the same amount of time that's going to get slower in 7.4 but because of the nature of properties we can get away with it I hope without too much of a hit other than that if you are really interested in keeping up with what's happening go to where's my URL bar one second go to wiki.php.net flash rfc and you'll see the collection how did I get to oho what the hell is oho typing in front of everyone it's a bad idea don't I have it here yeah there it is okay so go to wiki.php.net flash rfc and you will see some of the proposed rfc's always available hash extension that's basically just moving the hash extension from being optional to being sort of built in at all times you can see there's some things under discussion removing WDDX some namespace visibility stuff fibers I don't think we'll see it for 7.4 so fibers is a way of doing multitasking that's going to take some work that's probably an 80 feature but some of these other minor things are likely to come in 7.4 not all of them and down here you'll see a list of past things and hopefully the Jesus some deprecations you can read through that just have a look through this site it's way too early for me to stand up here and give a definitive list of 7.4 features it's going to change a lot in the next 6 months you guys need to cut me off when you want to maybe we can hold it after the talks and everything thank you