본문 바로가기

php foreach 유용하게 쓰일 듯 weights는 [][][] 삼차원 배열 foreach($weights['a1'] as $key => $value) { echo "key = $key, value = $value \n"; foreach($weights['a1'][$key] as $i => $value) { echo " i = $i, value = $value \n"; } } +추가로 reset($weights); +추가로 array_multisort($a1, SORT_DESC); 더보기
php include(), include_once(), require(), require_once()의 차이점 참고 :: http://kr2.php.net/manual/kr/function.include.php 두 구조는 수행 실패를 다루는 방법을 제외하고 완전히 동일합니다. 둘 모두 Warning을 발생시키지만, require()는 Fatal Error가 나타납니다. 즉, 파일이 없을 때 페이지 처리를 멈추고 싶으면 require()를 사용하면 됩니다. 파일을 찾는 경로도 include_path 먼저 찾고 다음으로 작업디렉토리에서 상대적인 경로로 찾게 된다. 라고 쓰여있다. 이왕이면 require를 쓸까... _once는 말그래도 한번만 추가하는거다... 이왕이면 _once를 쓸까... ---이런것은 어떻게 될까 a.php b.php c.php ---output this is c.php this is a.php.. 더보기
php 스트링 표현에도 이렇게 다른 점이... http://kr.php.net/manual/en/language.types.string.php 새삼 알았네... ' ' 로 묶는거랑, " " 로 묶는거랑, 더보기
php ereg/eregi/reg_replace deprecated.. 그래서... perl 정규표현식을... http://nobless_05.blog.me/50094471275 깔끔하게 글 잘 쓰셨다 더보기
java에서 cmd 실행하기 import java.io.*; class runTest{ public static void main(String a[]) { String cmd = "java"; Process p = null; String returnData = ""; try { p = Runtime.getRuntime().exec(cmd); InputStream in = p.getInputStream(); // Ȥ getErrorStream int i; while ((i=in.read()) != -1) { returnData += (char)i; } System.out.println(returnData); } catch (IOException e) { e.printStackTrace(); } } } 더보기